pub enum SubSignal {
Hangup,
ForceStop,
Interrupt,
Quit,
Terminate,
User1,
User2,
Custom(i32),
}
Expand description
A notification sent to a subprocess.
On Windows, only some signals are supported, as described. Others will be ignored.
On Unix, there are several “first-class” signals which have their own variants, and a generic
Custom
variant which can be used to send arbitrary signals.
Variants
Hangup
Indicate that the terminal is disconnected.
On Unix, this is SIGHUP
. On Windows, this is ignored for now but may be supported in the
future (see #219).
Despite its nominal purpose, on Unix this signal is often used to reload configuration files.
ForceStop
Indicate to the kernel that the process should stop.
On Unix, this is SIGKILL
. On Windows, this is TerminateProcess
.
This signal is not handled by the process, but directly by the kernel, and thus cannot be intercepted. Subprocesses may exit in inconsistent states.
Interrupt
Indicate that the process should stop.
On Unix, this is SIGINT
. On Windows, this is ignored for now but may be supported in the
future (see #219).
This signal generally indicates an action taken by the user, so it may be handled differently than a termination.
Quit
Indicate that the process is to stop, the kernel will then dump its core.
On Unix, this is SIGQUIT
. On Windows, it is ignored.
This is rarely used.
Terminate
Indicate that the process should stop.
On Unix, this is SIGTERM
. On Windows, this is ignored for now but may be supported in the
future (see #219).
On Unix, this signal generally indicates an action taken by the system, so it may be handled differently than an interruption.
User1
Indicate an application-defined behaviour should happen.
On Unix, this is SIGUSR1
. On Windows, it is ignored.
This signal is generally used to start debugging.
User2
Indicate an application-defined behaviour should happen.
On Unix, this is SIGUSR2
. On Windows, it is ignored.
This signal is generally used to reload configuration.
Custom(i32)
Indicate using a custom signal.
Internally, this is converted to a nix::Signal
but for portability this variant is a raw i32
.
Invalid signals on the current platform will be ignored. Does nothing on Windows.
Examples
use watchexec::signal::process::SubSignal;
use nix::sys::signal::Signal;
assert_eq!(SubSignal::Custom(6), SubSignal::from(Signal::SIGABRT as i32));
On Unix the from_nix
method should be preferred if converting from
Nix’s Signal
type:
use watchexec::signal::process::SubSignal;
use nix::sys::signal::Signal;
assert_eq!(SubSignal::Custom(6), SubSignal::from_nix(Signal::SIGABRT));
Implementations
Converts to a [nix::Signal
][command_group::Signal] if possible.
This will return None
if the signal is not supported on the current platform (only for
Custom
, as the first-class ones are always supported).
Trait Implementations
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for SubSignal
impl UnwindSafe for SubSignal
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more