Skip to content

Commit bc36181

Browse files
committed
Make nqp::shell work on Windows.
Means that the spectests that spawn a sub-process can now be run on Windows also.
1 parent 8645a09 commit bc36181

File tree

1 file changed

+5
-2
lines changed
  • src/vm/jvm/runtime/org/perl6/nqp/runtime

1 file changed

+5
-2
lines changed

src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,11 @@ public static long link(String before, String after) {
615615
public static long shell(String cmd) {
616616
long retval = 255;
617617
try {
618-
Process proc = new ProcessBuilder("sh", "-c", cmd)
619-
.inheritIO().start();
618+
String os = System.getProperty("os.name").toLowerCase();
619+
ProcessBuilder pb = os.indexOf("win") >= 0
620+
? new ProcessBuilder("cmd", "/c", cmd.replace('/', '\\'))
621+
: new ProcessBuilder("sh", "-c", cmd);
622+
Process proc = pb.inheritIO().start();
620623
proc.waitFor();
621624
retval = proc.exitValue();
622625
}

0 commit comments

Comments
 (0)