mirror of https://github.com/dapr/cli.git
preserve daprd log output (#559)
This commit is contained in:
parent
3dacfb672d
commit
3ae4ae2acf
27
cmd/run.go
27
cmd/run.go
|
@ -102,31 +102,8 @@ var RunCmd = &cobra.Command{
|
|||
output.DaprHTTPPort,
|
||||
output.DaprGRPCPort))
|
||||
|
||||
stdErrPipe, pipeErr := output.DaprCMD.StderrPipe()
|
||||
if pipeErr != nil {
|
||||
print.FailureStatusEvent(os.Stdout, fmt.Sprintf("Error creating stderr for Dapr: %s", err.Error()))
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
stdOutPipe, pipeErr := output.DaprCMD.StdoutPipe()
|
||||
if pipeErr != nil {
|
||||
print.FailureStatusEvent(os.Stdout, fmt.Sprintf("Error creating stdout for Dapr: %s", err.Error()))
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
errScanner := bufio.NewScanner(stdErrPipe)
|
||||
outScanner := bufio.NewScanner(stdOutPipe)
|
||||
go func() {
|
||||
for errScanner.Scan() {
|
||||
fmt.Println(print.Yellow(fmt.Sprintf("== DAPR == %s\n", errScanner.Text())))
|
||||
}
|
||||
}()
|
||||
|
||||
go func() {
|
||||
for outScanner.Scan() {
|
||||
fmt.Println(print.Yellow(fmt.Sprintf("== DAPR == %s\n", outScanner.Text())))
|
||||
}
|
||||
}()
|
||||
output.DaprCMD.Stdout = os.Stdout
|
||||
output.DaprCMD.Stderr = os.Stderr
|
||||
|
||||
err = output.DaprCMD.Start()
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue