#How to get stdout or stderr from failed Exec?

1 messages · Page 1 of 1 (latest)

wraith rock
#

I found out I can't access stdout or stderr if exec command is fails. Only error is provided. Is this a bug or intended behaviour?

Container:
container.From("alpine:3.14.2").Exec(dagger.ContainerExecOpts{Args: []string{"ash", "-ec", "echo 'Running pre-commit checks' && exit 1"}}).Stdout().Contents(ctx)

Error message:

`Error: input:1: container.from.exec.withEnvVariable.withEnvVariable.withMountedCache.withEnvVariable.withMountedCache.exec.withEnvVariable.withMountedCache.from.exec.stdout.contents process "/_shim ash -ec echo 'Running pre-commit checks' && exit 1" did not complete successfully: exit code: 1

Please visit https://dagger.io/help#go for troubleshooting guidance.`