routine signal
Documentation for routine signal
assembled from the following types:
class Kernel
From Kernel
(Kernel) method signal
Defined as:
multi method signal(Kernel: Str --> Int)multi method signal(Kernel: Signal \signal --> Int)multi method signal(Kernel: Int \signal --> Int)
Instance method returning the Signal
numeric code for a given name for the Kernel object.
say .signal("INT"); # OUTPUT: «2»
class Supply
From Supply
(Supply) sub signal
sub signal(*, : = )
Creates a supply for the Signal enums (such as SIGINT) specified, and an optional :scheduler
parameter. Any signals received, will be emitted on the supply. For example:
signal(SIGINT).tap( );
would catch Control-C, thank you, and then exit.
To go from a signal number to a Signal, you can do something like this:
signal(Signal(2)).tap( -> );
The list of supported signals can be found by checking Signal::.keys
(as you would any enum). For more details on how enums work see enum.
Note: Rakudo versions up to 2018.05 had a bug due to which numeric values of signals were incorrect on some systems. For example, Signal(10)
was returning SIGBUS
even if it was actually SIGUSR1
on a particular system. That being said, using signal(SIGUSR1)
was working as expected on all Rakudo versions except 2018.04, 2018.04.1 and 2018.05, where the intended behavior can be achieved by using signal(SIGBUS)
instead. These issues are resolved in Rakudo releases after 2018.05.
class Proc
From Proc
(Proc) method signal
method signal(Proc:)
Returns the signal number with which the external process was killed, or 0
or an undefined value otherwise.