Closed magicant closed 3 months ago
The changes in the yash-builtin
and yash-env
modules primarily focus on enhancing signal handling. This involves adding new signal-related functionalities, refactoring existing signal logic, and updating function signatures and structures to accommodate these improvements. Key updates include new methods for signal validation, mapping, and handling, along with modifications to job control, trap, kill, and wait mechanisms to use these new signal handling capabilities.
File(s) | Change Summary |
---|---|
yash-builtin/CHANGELOG.md |
Summarized changes in version 0.2.0 , highlighting additions, modifications, and removals. |
yash-builtin/src/bg.rs , fg.rs |
Updated signal handling logic, replacing direct signal usage with signal names. |
yash-builtin/src/jobs.rs |
Modified job control mechanisms, renamed fields, and updated method signatures. |
yash-builtin/src/kill.rs , print.rs , send.rs , signal.rs , syntax.rs |
Refactored signal handling, parsing, and execution logic, introduced new structures and methods. |
yash-builtin/src/set.rs |
Updated signal references to use new modules and structures. |
yash-builtin/src/trap.rs , cond.rs , syntax.rs |
Enhanced trap handling with new condition specifications and error handling improvements. |
yash-builtin/src/wait/core.rs |
Adjusted error handling and signal references in wait mechanisms. |
yash-env/src/system.rs |
Introduced new methods for signal validation, mapping, and handling, modified existing methods. |
sequenceDiagram
participant User
participant yash-builtin
participant yash-env
User->>yash-builtin: Send signal via kill command
yash-builtin->>yash-env: Validate and parse signal
yash-env-->>yash-builtin: Return signal number
yash-builtin->>yash-env: Execute signal handling
yash-env-->>yash-builtin: Signal action performed
yash-builtin-->>User: Confirmation of signal execution
In the code where signals play,
A rabbit hops through night and day.
With traps and kills, it deftly weaves,
Ensuring all the bugs it leaves.
Signals parsed with utmost care,
Inyash
, a system rare.
Hooray for changes, hip and bright,
The rabbit's code, a shining light! ππ
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
This is part of #353, and rework of #365.
This PR removes the use of
nix::signal::Signal
in theyash_env::System
API. The definition ofSignal
is dependent on the underlying system, so it should not be used outsideRealSystem
. Instead, new neutral items are added in theyash_env::signal
module.The new
Number
type replaces the most use ofSignal
. TheRealSystem
andVirtualSystem
now have differentNumber
spaces so that theVirtualSystem
no longer has to depend on theRealSystem
's signal number. The other uses ofSignal
s are replaced byName
s, which is more abstract thanNumber
s.This PR also adds (partial) support for real-time signals.
To fully support real-time signals, we also need to eliminate the use of
SigSet
, which is not the scope of this pull request.Number
andName
)From<Number>
forExitStatus
System::signal_number_from_name
andSystem::validate_signal_number
SystemEx:signal_name_from_number
SystemEx:signal_number_from_exit_status
which depends onSystem
and will replaceyash_env::job::fmt
Number
in virtualProcess
ProcessResult
containNumber
and update the implementation ofFrom<ProcessResult>
forExitStatus
, etc.yash::job::fmt
, which depends on the oldProcessResult
definition.yash_env::trap::Condition
containNumber
and update dependent implementations accordinglySystem::sigaction
System::caught_signals
System::kill
SelectSystem::set_signal_handling
SharedSystem::wait_for_signals
SharedSystem::wait_for_signal
yash::job::fmt
itemsProcessState::from_wait_status
by inlining the functionimpl TryFrom<Signal> for signal::Number
impl From<Signal> for ExitStatus
yash_builtin::trap::Command::execute
into smaller functionsSummary by CodeRabbit
New Features
Improvements
Bug Fixes
Documentation