Skip to content

accept a Symbol as the second argument to Signal.trap(…). #2321

Merged
merged 2 commits into from Apr 29, 2013

1 participant

@ghost
ghost commented Apr 29, 2013

On 1.9 mode Signal.trap can take a Symbol as a second argument in place of a
String. For example, you can say:

Signal.trap :SIGUSR1, :DEFAULT
Signal.trap :SIGUSR1, :SIG_DFT
Signal.trap :SIGUSR1, :SIG_IGN
Signal.trap :SIGUSR1, :IGNORE

I found this while trying to use Foreman on Rubinius. It has code that uses
:DEFAULT in place of "DEFAULT".

Side-note:
MRI 1.9 & 1.8 behavior is to accept any string or symbol as the second argument.
Rubinius(1.8 & 1.9) mode raise when the second argument isn't something it
understands. This is valid on CRuby, but not rubinius:

Signal.trap :SIGUSR1, "ninja"
Robert Gleeson added some commits Apr 29, 2013
Robert Gleeson accept a Symbol as the second argument to Signal.trap(…).
On 1.9 mode Signal.trap can take a Symbol as a second argument in place of a
String. For example, you can say:

  Signal.trap :SIGUSR1, :DEFAULT
  Signal.trap :SIGUSR1, :SIG_DFT
  Signal.trap :SIGUSR1, :SIG_IGN
  Signal.trap :SIGUSR1, :IGNORE

I found this while trying to use Foreman on Rubinius. It has code that uses
:DEFAULT in place of "DEFAULT".

Side-note:
MRI 1.9 & 1.8 behavior is to accept any string or symbol as the second argument.
Rubinius(1.8 & 1.9) mode raise when the second argument isn't something it
understands. This is valid on CRuby, but not rubinius:

  Signal.trap :SIGUSR1, "ninja"
9f55c49
Robert Gleeson add specs. 7ebf682
@jc00ke jc00ke merged commit 685e78d into rubinius:master Apr 29, 2013

1 check passed

Details default The Travis build passed
@ghost ghost deleted the unknown repository branch Apr 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.