Skip to content

Commit

Permalink
Disable JNA for Mac/M1 platform (#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet authored Oct 18, 2021
1 parent 427d05e commit fd2589f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public abstract class JnaNativePty extends AbstractPty implements Pty {

public static JnaNativePty current() throws IOException {
if (Platform.isMac()) {
if (Platform.is64Bit() && Platform.isARM()) {
throw new UnsupportedOperationException();
}
return OsXNativePty.current();
} else if (Platform.isLinux()) {
return LinuxNativePty.current();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@
*/
package org.jline.terminal.impl.jna;

import java.io.IOException;

import com.sun.jna.Platform;
import org.jline.terminal.Size;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assume.assumeFalse;
import static org.junit.Assume.assumeTrue;

public class JnaNativePtyTest {
Expand All @@ -20,4 +26,22 @@ public void testDescriptor() {
assumeTrue(!System.getProperty( "os.name" ).startsWith( "Windows"));
assertNotNull(JnaNativePty.newDescriptor(4));
}


@Test
public void testOpen() throws IOException {
// https://github.com/jline/jline3/issues/688
// currently disabled on Mac M1 silicon
assumeFalse(Platform.isMac() && Platform.is64Bit() && Platform.isARM());
assumeFalse(Platform.isWindows());
JnaNativePty pty = JnaNativePty.open(null, null);
assertNotNull(pty);
Size sz = pty.getSize();
assertNotNull(sz);
Size nsz = new Size(sz.getColumns() + 1, sz.getRows() + 1);
pty.setSize(nsz);
sz = pty.getSize();
assertNotNull(sz);
assertEquals(nsz, sz);
}
}

0 comments on commit fd2589f

Please sign in to comment.