-
-
Notifications
You must be signed in to change notification settings - Fork 422
Fixed compiler output capture in JSON mode #2078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
057516d
c4595f6
816a681
8b73eee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Some instances of ctx.Stdout may now contains nil since it's no more altered during ExecCommand.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,29 +184,30 @@ const ( | |
) | ||
|
||
func ExecCommand(ctx *types.Context, command *exec.Cmd, stdout int, stderr int) ([]byte, []byte, error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got inspired by this refactoring, but do what you want with it. Since it took longer than expected it might not be that good
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is something to keep in mind when this subroutine will be merged with |
||
if ctx.Stdout == nil { | ||
ctx.Stdout = os.Stdout | ||
} | ||
if ctx.Stderr == nil { | ||
ctx.Stderr = os.Stderr | ||
} | ||
|
||
if ctx.Verbose { | ||
ctx.Info(PrintableCommand(command.Args)) | ||
} | ||
|
||
if stdout == Capture { | ||
buffer := &bytes.Buffer{} | ||
command.Stdout = buffer | ||
} else if stdout == Show || stdout == ShowIfVerbose && ctx.Verbose { | ||
command.Stdout = ctx.Stdout | ||
} else if stdout == Show || (stdout == ShowIfVerbose && ctx.Verbose) { | ||
if ctx.Stdout != nil { | ||
command.Stdout = ctx.Stdout | ||
} else { | ||
command.Stdout = os.Stdout | ||
} | ||
} | ||
|
||
if stderr == Capture { | ||
buffer := &bytes.Buffer{} | ||
command.Stderr = buffer | ||
} else if stderr == Show || stderr == ShowIfVerbose && ctx.Verbose { | ||
command.Stderr = ctx.Stderr | ||
} else if stderr == Show || (stderr == ShowIfVerbose && ctx.Verbose) { | ||
if ctx.Stderr != nil { | ||
command.Stderr = ctx.Stderr | ||
} else { | ||
command.Stderr = os.Stderr | ||
} | ||
} | ||
|
||
err := command.Start() | ||
|