2
2
3
3
import java .io .File ;
4
4
import java .io .IOException ;
5
- import java .io .InputStream ;
6
- import java .io .OutputStream ;
7
- import java .nio .ByteBuffer ;
8
- import java .nio .channels .ByteChannel ;
9
- import java .nio .channels .Channels ;
10
- import java .nio .channels .ReadableByteChannel ;
11
- import java .nio .channels .WritableByteChannel ;
5
+ import java .lang .ProcessBuilder .Redirect ;
12
6
import java .nio .charset .Charset ;
13
7
import java .util .Map ;
14
8
15
9
import org .perl6 .nqp .runtime .ExceptionHandling ;
16
10
import org .perl6 .nqp .runtime .ThreadContext ;
17
11
18
12
public class ProcessHandle extends SyncHandle {
19
-
13
+
20
14
Process process ;
21
15
22
16
public ProcessHandle (ThreadContext tc , String cmd , String dir , Map <String , String > env ) {
@@ -28,13 +22,13 @@ public ProcessHandle(ThreadContext tc, String cmd, String dir, Map<String, Strin
28
22
pb = new ProcessBuilder ("sh" , "-c" , cmd );
29
23
}
30
24
pb .directory (new File (dir ));
31
- pb .redirectErrorStream ( true );
25
+ pb .redirectError ( Redirect . INHERIT );
32
26
33
27
// Clear the JVM inherited environment and use provided only
34
28
Map <String , String > pbEnv = pb .environment ();
35
29
pbEnv .clear ();
36
30
pbEnv .putAll (env );
37
-
31
+
38
32
try {
39
33
process = pb .start ();
40
34
chan = new ProcessChannel (process , process .getOutputStream (), process .getInputStream ());
@@ -43,7 +37,7 @@ public ProcessHandle(ThreadContext tc, String cmd, String dir, Map<String, Strin
43
37
throw ExceptionHandling .dieInternal (tc , e );
44
38
}
45
39
}
46
-
40
+
47
41
public void flush (ThreadContext tc ) {
48
42
// Not provided.
49
43
}
0 commit comments