Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
asdfasd
Browse files Browse the repository at this point in the history
headius committed Jun 26, 2018
1 parent 9f86e0e commit dee13d7
Showing 6 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/pom.rb
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@
jar 'com.github.jnr:jnr-enxio:0.17', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-x86asm:1.0.2', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-unixsocket:0.19', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-posix:3.0.45', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-posix:3.0.46', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-constants:0.9.9', :exclusions => ['com.github.jnr:jnr-ffi']
jar 'com.github.jnr:jnr-ffi:2.1.8'
jar 'com.github.jnr:jffi:${jffi.version}'
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
@@ -134,7 +134,7 @@ DO NOT MODIFIY - GENERATED CODE
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-posix</artifactId>
<version>3.0.45</version>
<version>3.0.46</version>
<exclusions>
<exclusion>
<artifactId>jnr-ffi</artifactId>
6 changes: 6 additions & 0 deletions core/src/main/java/org/jruby/Main.java
Original file line number Diff line number Diff line change
@@ -38,6 +38,7 @@

package org.jruby;

import jnr.posix.POSIXFactory;
import org.jruby.exceptions.MainExitException;
import org.jruby.exceptions.JumpException;
import org.jruby.exceptions.RaiseException;
@@ -413,6 +414,11 @@ private Status doRunFromMain(Ruby runtime, InputStream in, String filename) {
doCheckSecurityManager();

runtime.runFromMain(in, filename);
} catch (SignalException se) {
int status = se.signal();
// TODO: reset handler to default before raising
POSIXFactory.getPOSIX().raise(status);
return new Status(1);
} catch (RaiseException rj) {
return new Status(handleRaiseException(rj));
}
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubySignalException.java
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ protected RubySignalException(Ruby runtime, RubyClass exceptionClass) {

@Override
protected RaiseException constructThrowable(String message) {
return new SignalException(message, this);
return new SignalException(message, this, this.signo.convertToInteger().getIntValue());
}

static RubyClass define(Ruby runtime, RubyClass exceptionClass) {
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/exceptions/Interrupt.java
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@

package org.jruby.exceptions;

import jnr.constants.platform.Signal;
import org.jruby.RubyInterrupt;

/**
@@ -35,6 +36,6 @@
*/
public class Interrupt extends SignalException {
public Interrupt(String message, RubyInterrupt exception) {
super(message, exception);
super(message, exception, Signal.SIGINT.intValue());
}
}
9 changes: 8 additions & 1 deletion core/src/main/java/org/jruby/exceptions/SignalException.java
Original file line number Diff line number Diff line change
@@ -34,7 +34,14 @@
* @see RubySignalException
*/
public class SignalException extends Exception {
public SignalException(String message, RubySignalException exception) {
private final int signal;
public SignalException(String message, RubySignalException exception, int signal) {
super(message, exception);

this.signal = signal;
}

public int signal() {
return signal;
}
}

0 comments on commit dee13d7

Please sign in to comment.