Skip to content

Commit 9e6f597

Browse files
author
Franziska Geiger
committed
Added stdderr of java process to console output
1 parent 67b9cfb commit 9e6f597

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/PosixModuleBuiltins.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,12 +338,19 @@ Object doExecute(PythonModule thisModule, String path, PSequence args) {
338338
environment.put(new String(toBytes.execute(null, (PBytes) entry.key)), new String(toBytes.execute(null, (PBytes) entry.value)));
339339
});
340340
Process pr = builder.start();
341-
// retrieve output from executed script
342341
BufferedReader bfr = new BufferedReader(new InputStreamReader(pr.getInputStream()));
343342
OutputStream stream = getContext().getEnv().out();
344343
String line = "";
345344
while ((line = bfr.readLine()) != null) {
346345
stream.write(line.getBytes());
346+
stream.write("\n".getBytes());
347+
}
348+
BufferedReader stderr = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
349+
OutputStream errStream = getContext().getEnv().err();
350+
line = "";
351+
while ((line = stderr.readLine()) != null) {
352+
errStream.write(line.getBytes());
353+
errStream.write("\n".getBytes());
347354
}
348355
try {
349356
pr.waitFor();

0 commit comments

Comments
 (0)