Skip to content

Commit b591400

Browse files
committed
nqp::openpipe handling for Windows.
1 parent a47a76b commit b591400

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/vm/jvm/runtime/org/perl6/nqp/io/ProcessHandle.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ public class ProcessHandle extends SyncHandle {
2121
Process process;
2222

2323
public ProcessHandle(ThreadContext tc, String cmd, String dir, Map<String, String> env) {
24-
ProcessBuilder pb = new ProcessBuilder("sh", "-c", cmd);
24+
ProcessBuilder pb;
25+
String os = System.getProperty("os.name").toLowerCase();
26+
if (os.indexOf("win") >= 0) {
27+
pb = new ProcessBuilder("cmd", "/c", cmd.replace('/', '\\'));
28+
} else {
29+
pb = new ProcessBuilder("sh", "-c", cmd);
30+
}
2531
pb.directory(new File(dir));
2632
pb.redirectErrorStream(true);
2733

0 commit comments

Comments
 (0)