Skip to content

Commit

Permalink
improvement(core): log stderr from exec as info (#5227)
Browse files Browse the repository at this point in the history
Before this change, we logged stderr streams from
init scripts as errors but now we log it at the info level.

The reason is that some tools, e.g. gcloud, write to stderr even if it's
not an actual error.

In the case of an actual error the script exits with a non-zero
code and that's handled specifically.

So this is really just a cosmetic change to how exec provider logs are
rendered.
  • Loading branch information
eysi09 committed Oct 11, 2023
1 parent 3ac6e65 commit c6016f4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/src/util/util.ts
Expand Up @@ -667,7 +667,14 @@ export async function runScript({
log.error(line.toString())
})
errorStream.on("data", (line: Buffer) => {
log.error(line.toString())
// NOTE: We're intentionally logging stderr streams at the "info" level
// because some tools will write to stderr even if it's not an actual error.
// So rendering it as such will look confusing to the user.
// An example of this is the gcloud CLI tool. If run from e.g. the exec
// provider init script, Garden would log those lines as errors if we don't
// use the info level here.
// Actual error are handled specifically.
log.info(line.toString())
})
// Workaround for https://github.com/vercel/pkg/issues/897
env.PKG_EXECPATH = ""
Expand Down

0 comments on commit c6016f4

Please sign in to comment.