Automatically pump streams with os.Inherit
on changed System.out
System.err
System.in
#282
Milestone
os.Inherit
on changed System.out
System.err
System.in
#282
In Mill server-client mode the standard streams are changed using
System.setOut
, etc. methods so they can be propagated from the server to the client and shown to the user's console.Unfortunately, when running processes with
os.proc
andos.Inherit
the changes done withSystem.setOut
, etc. are not honored, since thejava.lang.ProcessBuilder
doesn't honor the changes in System streams.This issue is about natively support honoring the changes in streams in
os.proc
without users having to manually redirect the output and the input via pipes.Since there is no way to know if the streams were changed, os-lib would need to add an API to allow users to set the original streams, like:
So when a process is executed and
System.in ne os.proc.originalSystemIn && stdin == os.Inherit
it would pump the data to theSystem.in
usingos.Pipe
(as we currently do in Mill), since it assumes it is not the originalSystem.in
.The same thing would happen with
System.out
andSystem.err
.To work around this problem, Mill implemented some helper methods, but they are bespoke and are not what users would want to write.
In fact, many plugins and users' builds in the wild just use
os.proc
withos.Inherit
since it's the easiest way, and then they see broken output in server-client mode.The text was updated successfully, but these errors were encountered: