- Tweaked build for linux.
- Tweaked how errno is sent back to Java land.
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
|
||||
void markFailed(JNIEnv *env, jobject result) {
|
||||
jclass destClass = env->GetObjectClass(result);
|
||||
jfieldID errnoField = env->GetFieldID(destClass, "errno", "I");
|
||||
env->SetIntField(result, errnoField, errno);
|
||||
jmethodID method = env->GetMethodID(destClass, "failed", "(I)V");
|
||||
env->CallVoidMethod(result, method, errno);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
|
||||
@@ -17,7 +17,11 @@ public class Platform {
|
||||
if (!loaded) {
|
||||
System.setProperty("java.library.path", new File("build/binaries").getAbsolutePath());
|
||||
try {
|
||||
System.load(new File("build/binaries/libnative-platform.dylib").getCanonicalPath());
|
||||
File libFile = new File("build/binaries/libnative-platform.dylib");
|
||||
if (!libFile.isFile()) {
|
||||
libFile = new File("build/binaries/libnative-platform.so");
|
||||
}
|
||||
System.load(libFile.getCanonicalPath());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,10 @@ package net.rubygrapefruit.platform.internal;
|
||||
public class FunctionResult {
|
||||
int errno;
|
||||
|
||||
void failed(int errno) {
|
||||
this.errno = errno;
|
||||
}
|
||||
|
||||
public boolean isFailed() {
|
||||
return errno != 0;
|
||||
}
|
||||
|
||||
@@ -14,12 +14,12 @@ class TerminalTest extends Specification {
|
||||
!terminal.isTerminal(Terminal.Output.Stderr);
|
||||
}
|
||||
|
||||
def "cannot detemine terminal size from a test"() {
|
||||
def "cannot determine terminal size from a test"() {
|
||||
when:
|
||||
terminal.getTerminalSize(Terminal.Output.Stdout)
|
||||
|
||||
then:
|
||||
NativeException e = thrown()
|
||||
e.message == 'Could not get terminal size. Errno is 25.'
|
||||
e.message.startsWith('Could not get terminal size. Errno is ')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user