Skip to content

Commit

Permalink
asdfasd
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Jun 26, 2018
1 parent 9f86e0e commit dee13d7
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/pom.rb
Expand Up @@ -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}'
Expand Down
2 changes: 1 addition & 1 deletion core/pom.xml
Expand Up @@ -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>
Expand Down
6 changes: 6 additions & 0 deletions core/src/main/java/org/jruby/Main.java
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubySignalException.java
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/exceptions/Interrupt.java
Expand Up @@ -26,6 +26,7 @@

package org.jruby.exceptions;

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

/**
Expand All @@ -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
Expand Up @@ -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.