Closed Oshuma closed 4 years ago
Looks good, thanks :)
To stream stdout/stderr to Jupyter, you need four things:
Cmd.StdoutPipe()
and Cmd.StderrPipe()
of the struct os/exec.Cmd
you are already usingKernel.handleExecuteRequest
to create the two JupyterStreamWriter
immediately - it currently creates them inside goroutines - and pass them to doEval()
and further down to your evalShellCommand
.Cmd.StdoutPipe()
and writing into the first JupyterStreamWriter
. You can copy and adapt the code in kernel.go, lines 406-411Cmd.StderrPipe()
and writing into the second JupyterStreamWriter
. You can copy and adapt the code in kernel.go, lines 413-417Note: be careful to wait for the command to exit and for the goroutines to finish before returning from evalShellCommand
@cosmos72 Sounds good. I'll implement that as soon as I get a chance and update this PR.
@cosmos72 Can you verify/merge when you get a chance?
merged, with some little improvements. Thanks!
Issue #196
The only thing left is to steam stdout/stderr to Jupyter. I couldn't quite figure out how to do that, so if anyone could give me some pointers/examples, I can implement it.