Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b7379c8e2518
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7ff654bdb411
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Nov 12, 2014

  1. Fix invalid signals passed to restorePlatformDefault. Those need to be

    handled by the fake signal handler instead.
    cheald committed Nov 12, 2014
    Copy the full SHA
    a83b08e View commit details
  2. Merge pull request #2175 from cheald/signal_fix

    Fix invalid signals passed to restorePlatformDefault.
    enebo committed Nov 12, 2014
    Copy the full SHA
    7ff654b View commit details
Showing with 9 additions and 7 deletions.
  1. +9 −5 core/src/main/java/org/jruby/util/SunSignalFacade.java
  2. +0 −2 test/mri/excludes/TestSignal.rb
14 changes: 9 additions & 5 deletions core/src/main/java/org/jruby/util/SunSignalFacade.java
Original file line number Diff line number Diff line change
@@ -115,8 +115,12 @@ private IRubyObject trap(final Ruby runtime, final JRubySignalHandler handler) {
public IRubyObject restorePlatformDefault(IRubyObject recv, IRubyObject sig) {
SignalHandler handler;
Ruby runtime = recv.getRuntime();
synchronized (original) {
handler = original.get(new Signal(sig.toString()));
try {
synchronized (original) {
handler = original.get(new Signal(sig.toString()));
}
} catch (IllegalArgumentException e) {
handler = null;
}
if (handler != null) {
return trap(runtime, sig.toString(), handler);
@@ -188,12 +192,12 @@ public IRubyObject call(ThreadContext context, IRubyObject[] args, Block block)
return runtime.getNil();
}
};
if (oldHandler == null) {
retVals[0] = runtime.newString("DEFAULT");
} else if (oldHandler == SignalHandler.SIG_DFL) {
if (oldHandler == SignalHandler.SIG_DFL) {
retVals[0] = runtime.newString("SYSTEM_DEFAULT");
} else if (oldHandler == SignalHandler.SIG_IGN) {
retVals[0] = runtime.newString("IGNORE");
} else {
retVals[0] = runtime.newString("DEFAULT");
}
} else {
final RubyModule signalModule = runtime.getModule("Signal");
2 changes: 0 additions & 2 deletions test/mri/excludes/TestSignal.rb
Original file line number Diff line number Diff line change
@@ -5,8 +5,6 @@
exclude :test_trap, "SignalException needs to be its own class which provides a #signo accessor"
exclude :test_signal_exception, "SignalException needs to be its own class which enforces args"
exclude :test_signame, "needs investigation - OutOfMemoryError"

# exclude :test_ignored_interrupt, "uses SIGINT which is already in use on the JVM"
exclude :test_trap_uncatchable_KILL, "uses SIGKILL which is already in use on the JVM"
exclude :test_trap_uncatchable_STOP, "uses SIGSTOP which is already in use on the JVM"
exclude :test_trap_puts, "fails due to use of INT. Works when the test uses SIGUSR2"