Skip to content

Commit 92be922

Browse files
committed
code: Always display the output of code blocks
Any output that is printed may still be useful even if the command returns an error so lets display it. Printing out even in case of error is fine, if there's no output and output.Write handles that fine. I tested this by trying to run a code block for a language I do not have the compiler for.
1 parent f9b0cda commit 92be922

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

internal/code/code.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,9 @@ func Execute(code Block) Result {
122122
// execute and write output
123123
cmd := exec.Command(command[0], command[1:]...)
124124
out, err := cmd.Output()
125+
output.Write(out)
125126
if err != nil {
126127
output.Write([]byte(err.Error()))
127-
} else {
128-
output.Write(out)
129128
}
130129

131130
// update status code

0 commit comments

Comments
 (0)