Skip to content
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

ddClient.docker.cli.exec result seems not to have code ever #126

Open
jnummelin opened this issue Apr 8, 2022 · 1 comment
Open

ddClient.docker.cli.exec result seems not to have code ever #126

jnummelin opened this issue Apr 8, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@jnummelin
Copy link

Consider this example invocation of ddClient.docker.cli.exec:

const r = await ddClient.docker.cli.exec("info", [])
r.code // r.code is always undefined

I can see the code field marked as Optional, but all the execs I've tried have not had it populated.

Is it actually populated ever?

Currently the only somewhat sane way to check exec success is to look at result.stderr being empty. Which is always bit sketchy.

@gtardif
Copy link
Contributor

gtardif commented Apr 11, 2022

Hello, Thx for the feedback.

We do actually send the exit code only in case of failures, we should also send it (value '0') when everything is OK.
If you change the command to include a typo, in order to make it fail, you should see the exit code along with the error message in stderr.
Screenshot 2022-04-11 at 13 35 46

For now you should be able to rely on code exists and not equal to zero, we'll add it with value zero when the execution is successful in a next relase.

@benja-M-1 benja-M-1 added the enhancement New feature or request label Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants