Skip to content

Commit

Permalink
Support for mingw, fixes #50
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Dec 2, 2016
1 parent bc29571 commit 85e44ed
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions demo/jline-gogo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,14 @@ while [ "${1}" != "" ]; do
done

cygwin=false
mingw=false
case "$(uname)" in
CYGWIN*)
cygwin=true
;;
MINGW*)
mingw=true
;;
esac
if ${cygwin}; then
cp=$(cygpath --path --windows "${cp}")
Expand All @@ -102,3 +106,4 @@ echo "Classpath: $cp"
echo "Launching Gogo JLine..."
set mouse=a
java -cp $cp $opts org.apache.felix.gogo.jline.Main

2 changes: 1 addition & 1 deletion src/main/java/org/jline/terminal/TerminalBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private Terminal doBuild() throws IOException {
//
// Cygwin support
//
if (OSUtils.IS_CYGWIN) {
if (OSUtils.IS_CYGWIN || OSUtils.IS_MINGW) {
try {
Pty pty = ExecPty.current();
return new PosixSysTerminal(name, type, pty, encoding, nativeSignals, signalHandler);
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/jline/utils/OSUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ public class OSUtils {
&& System.getenv("PWD").startsWith("/")
&& !"cygwin".equals(System.getenv("TERM"));

public static final boolean IS_MINGW = IS_WINDOWS
&& System.getenv("MSYSTEM") != null
&& System.getenv("MSYSTEM").startsWith("MINGW");

public static final boolean IS_OSX = System.getProperty("os.name").toLowerCase().contains("mac");

public static String TTY_COMMAND;
Expand All @@ -31,7 +35,7 @@ public class OSUtils {
String stty;
String sttyfopt;
String infocmp;
if (OSUtils.IS_CYGWIN) {
if (OSUtils.IS_CYGWIN || OSUtils.IS_MINGW) {
tty = "tty.exe";
stty = "stty.exe";
sttyfopt = null;
Expand Down

0 comments on commit 85e44ed

Please sign in to comment.