Pass stdout/stderr into pmuxlib.Run
This commit is contained in:
parent
7a78680038
commit
29241f144a
2
main.go
2
main.go
@ -43,5 +43,5 @@ func main() {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
pmuxlib.Run(ctx, cfg)
|
pmuxlib.Run(ctx, os.Stdout, os.Stderr, cfg)
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ package pmuxlib
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"os"
|
"io"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -16,12 +16,16 @@ type Config struct {
|
|||||||
// Run runs the given configuration as if this was a real pmux process. It will
|
// Run runs the given configuration as if this was a real pmux process. It will
|
||||||
// block until the context is canceled and all child processes have been cleaned
|
// block until the context is canceled and all child processes have been cleaned
|
||||||
// up.
|
// up.
|
||||||
func Run(ctx context.Context, cfg Config) {
|
func Run(
|
||||||
|
ctx context.Context,
|
||||||
|
stdout, stderr io.Writer,
|
||||||
|
cfg Config,
|
||||||
|
) {
|
||||||
|
|
||||||
stdoutLogger := newLogger(os.Stdout, logSepStdout, cfg.TimeFormat)
|
stdoutLogger := newLogger(stdout, logSepStdout, cfg.TimeFormat)
|
||||||
defer stdoutLogger.Close()
|
defer stdoutLogger.Close()
|
||||||
|
|
||||||
stderrLogger := newLogger(os.Stderr, logSepStderr, cfg.TimeFormat)
|
stderrLogger := newLogger(stderr, logSepStderr, cfg.TimeFormat)
|
||||||
defer stderrLogger.Close()
|
defer stderrLogger.Close()
|
||||||
|
|
||||||
sysLogger := stderrLogger.withSep(logSepSys)
|
sysLogger := stderrLogger.withSep(logSepSys)
|
||||||
|
Loading…
Reference in New Issue
Block a user