@@ -55,12 +55,10 @@ public void close() throws IOException {
55
55
/**
56
56
* Spawns the native controllers for each module.
57
57
*
58
- * @param environment The node environment
59
- * @param inheritIo Should the stdout and stderr of the spawned process inherit the
60
- * stdout and stderr of the JVM spawning it?
58
+ * @param environment the node environment
61
59
* @throws IOException if an I/O error occurs reading the module or spawning a native process
62
60
*/
63
- void spawnNativeControllers (final Environment environment , final boolean inheritIo ) throws IOException {
61
+ void spawnNativeControllers (final Environment environment ) throws IOException {
64
62
if (!spawned .compareAndSet (false , true )) {
65
63
throw new IllegalStateException ("native controllers already spawned" );
66
64
}
@@ -85,7 +83,7 @@ void spawnNativeControllers(final Environment environment, final boolean inherit
85
83
modules .getFileName ());
86
84
throw new IllegalArgumentException (message );
87
85
}
88
- final Process process = spawnNativeController (spawnPath , environment .tmpFile (), inheritIo );
86
+ final Process process = spawnNativeController (spawnPath , environment .tmpFile ());
89
87
processes .add (process );
90
88
}
91
89
}
@@ -94,7 +92,7 @@ void spawnNativeControllers(final Environment environment, final boolean inherit
94
92
* Attempt to spawn the controller daemon for a given module. The spawned process will remain connected to this JVM via its stdin,
95
93
* stdout, and stderr streams, but the references to these streams are not available to code outside this package.
96
94
*/
97
- private Process spawnNativeController (final Path spawnPath , final Path tmpPath , final boolean inheritIo ) throws IOException {
95
+ private Process spawnNativeController (final Path spawnPath , final Path tmpPath ) throws IOException {
98
96
final String command ;
99
97
if (Constants .WINDOWS ) {
100
98
/*
@@ -116,14 +114,6 @@ private Process spawnNativeController(final Path spawnPath, final Path tmpPath,
116
114
pb .environment ().clear ();
117
115
pb .environment ().put ("TMPDIR" , tmpPath .toString ());
118
116
119
- // The process _shouldn't_ write any output via its stdout or stderr, but if it does then
120
- // it will block if nothing is reading that output. To avoid this we can inherit the
121
- // JVM's stdout and stderr (which are redirected to files in standard installations).
122
- if (inheritIo ) {
123
- pb .redirectOutput (ProcessBuilder .Redirect .INHERIT );
124
- pb .redirectError (ProcessBuilder .Redirect .INHERIT );
125
- }
126
-
127
117
// the output stream of the process object corresponds to the daemon's stdin
128
118
return pb .start ();
129
119
}
0 commit comments