mirror of https://github.com/Hilbis/Hilbish
fix: make stdout/stderr optional
parent
960badb5df
commit
da92f6b7b4
10
api.go
10
api.go
|
@ -203,9 +203,13 @@ func hlrun(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
|||
stderrStream = f
|
||||
}
|
||||
|
||||
strms = &streams{
|
||||
stdout: stdoutStream.Handle(),
|
||||
stderr: stderrStream.Handle(),
|
||||
strms = &streams{}
|
||||
if stdoutStream != nil {
|
||||
strms.stdout = stdoutStream.Handle()
|
||||
}
|
||||
|
||||
if stderrStream != nil {
|
||||
strms.stderr = stderrStream.Handle()
|
||||
}
|
||||
} else {
|
||||
if !terminalOut {
|
||||
|
|
12
exec.go
12
exec.go
|
@ -272,11 +272,17 @@ func execCommand(cmd string, strms *streams) (io.Writer, io.Writer, error) {
|
|||
runner, _ := interp.New()
|
||||
|
||||
if strms == nil {
|
||||
strms = &streams{
|
||||
stdout: os.Stdout,
|
||||
stderr: os.Stderr,
|
||||
strms = &streams{}
|
||||
}
|
||||
|
||||
if strms.stdout == nil {
|
||||
strms.stdout = os.Stdout
|
||||
}
|
||||
|
||||
if strms.stderr == nil {
|
||||
strms.stderr = os.Stderr
|
||||
}
|
||||
|
||||
interp.StdIO(os.Stdin, strms.stdout, strms.stderr)(runner)
|
||||
|
||||
buf := new(bytes.Buffer)
|
||||
|
|
Loading…
Reference in New Issue