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
|
stderrStream = f
|
||||||
}
|
}
|
||||||
|
|
||||||
strms = &streams{
|
strms = &streams{}
|
||||||
stdout: stdoutStream.Handle(),
|
if stdoutStream != nil {
|
||||||
stderr: stderrStream.Handle(),
|
strms.stdout = stdoutStream.Handle()
|
||||||
|
}
|
||||||
|
|
||||||
|
if stderrStream != nil {
|
||||||
|
strms.stderr = stderrStream.Handle()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if !terminalOut {
|
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()
|
runner, _ := interp.New()
|
||||||
|
|
||||||
if strms == nil {
|
if strms == nil {
|
||||||
strms = &streams{
|
strms = &streams{}
|
||||||
stdout: os.Stdout,
|
|
||||||
stderr: os.Stderr,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
interp.StdIO(os.Stdin, strms.stdout, strms.stderr)(runner)
|
||||||
|
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
|
|
Loading…
Reference in New Issue