How to get exit code of command from exec_run(stream=True)?
See original GitHub issueAs the title says, how can I get the exit code of a command when using exec_run()
with stream=True
?
result = container.exec_run(cmd, stream=True, **kwargs)
for line in result.output:
sys.stdout.buffer.write(b' ')
sys.stdout.buffer.write(line)
print(result) # exit_code is None
Thank you
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Bash get exit code of command on a Linux / Unix - nixCraft
Bash get exit code of command - Learn how to get the exit code of command using $? in Linux or Unix shell...
Read more >Containers — Docker SDK for Python 6.0.1 documentation
Block until the container stops, then return its exit code. Similar to the docker wait command. Parameters. timeout (int) – Request timeout.
Read more >Get exit code from command "exec" - Unix Stack Exchange
The only way that exec's exit status can be interpreted by the line following exec is if the exec calls fails, normally only...
Read more >Ubuntu Manpage: docker-container-exec - Run a command in ...
docker-container-exec - Run a command in a running container ... The exit code from docker exec gives information about why the container failed...
Read more >Bash command line exit codes demystified | Enable Sysadmin
When you execute a command or run a script, you receive an exit code. An exit code is a system response that reports...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Exit code should be in this metadata:
I found a workaround. Maybe this or similar functionality could be added to the
ExitResult
returned byContainer.exec_run()
?Usage example