|
40 | 40 | import java.io.PrintStream;
|
41 | 41 | import java.util.Map.Entry;
|
42 | 42 |
|
43 |
| -import com.oracle.truffle.api.CompilerDirectives; |
44 | 43 | import org.jcodings.specific.ASCIIEncoding;
|
45 | 44 | import org.jcodings.specific.UTF8Encoding;
|
46 | 45 | import org.truffleruby.Layouts;
|
|
57 | 56 | import org.truffleruby.core.proc.ProcOperations;
|
58 | 57 | import org.truffleruby.core.rope.CodeRange;
|
59 | 58 | import org.truffleruby.core.string.StringNodes.MakeStringNode;
|
60 |
| -import org.truffleruby.core.thread.ThreadManager; |
61 | 59 | import org.truffleruby.core.string.StringOperations;
|
| 60 | +import org.truffleruby.core.thread.ThreadManager; |
62 | 61 | import org.truffleruby.language.backtrace.Backtrace;
|
63 | 62 | import org.truffleruby.language.control.ExitException;
|
64 | 63 | import org.truffleruby.language.control.RaiseException;
|
|
70 | 69 | import org.truffleruby.language.yield.YieldNode;
|
71 | 70 | import org.truffleruby.platform.Signals;
|
72 | 71 |
|
| 72 | +import com.oracle.truffle.api.CompilerDirectives; |
73 | 73 | import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
|
74 | 74 | import com.oracle.truffle.api.TruffleContext;
|
75 | 75 | import com.oracle.truffle.api.dsl.Cached;
|
|
79 | 79 | import com.oracle.truffle.api.profiles.BranchProfile;
|
80 | 80 | import com.oracle.truffle.api.profiles.ConditionProfile;
|
81 | 81 |
|
| 82 | +import sun.misc.Signal; |
| 83 | + |
82 | 84 | @CoreModule(value = "VMPrimitives", isClass = true)
|
83 | 85 | public abstract class VMPrimitiveNodes {
|
84 | 86 |
|
@@ -262,8 +264,13 @@ protected boolean watchSignalProc(DynamicObject signalName, DynamicObject action
|
262 | 264 | final PrintStream printStream = new PrintStream(context.getEnv().err(), true);
|
263 | 265 | printStream.println(
|
264 | 266 | "[ruby] SEVERE: signal " + signal +
|
265 |
| - " caught but can't create a thread to handle it so ignoring and restoring the default handler"); |
| 267 | + " caught but can't attach a thread to handle it so restoring the default handler and re-raising the signal"); |
266 | 268 | Signals.restoreDefaultHandler(signal);
|
| 269 | + try { |
| 270 | + Signal.raise(new Signal(signal)); |
| 271 | + } catch (IllegalArgumentException illegalArgumentException) { |
| 272 | + illegalArgumentException.printStackTrace(printStream); |
| 273 | + } |
267 | 274 | return;
|
268 | 275 | }
|
269 | 276 | try {
|
|
0 commit comments