-
Notifications
You must be signed in to change notification settings - Fork 148
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
ExecResult::exit_code
returns None
due to command not finishing
#744
Comments
It's generally expected, see the documentation for ExecResult::exit_code
In order to achieve your goal you need to utilize with_cmd_ready_conditions to specify what you're waiting for. Particularly - CmdWaitFor::exit_code Did you try? I guess it's worth to add mention of But the interface is expected, since sometimes it's necessary to spawn some background command without waiting for its results. Or in case you want to have some custom logic which periodically checks the status of the command. |
Ah no I actually completely missed the ready condition for commands 🤦🏿 my mistake. I see |
Yes, you're right. It will wait for particular exit code and will return an error if actual one doesn't match with expected ( We can consider shortcut "WaitCmdFor::Finish" which will ignore the code. However even right now it should be possible by handling the error returned |
It was possible via explicit error handling in the client code, but it's a nice shortcut Closes #744
It was possible via explicit error handling in the client code, but it's a nice shortcut Closes #744
The
ExecResult
type returned fromContainerAsync::exec
does not seem to represent a the command being completed, instead it returns before the executed command completes.I would assume I can use
ExecResult::exit_code().await
to wait for the command to fully run and get the exit code, but instead it returns anOption::None
when the command has not completed.One workaround I found is to call
ExecResult::stdout_to_vec().await
andExecResult::stderr_to_vec().await
to stream the outputs until completion before callingExecResult::exit_code().await
. However this is far from ideal, as I need to await both these streams in order to be sure the command has completed. It would be nice if there's aExecResult::wait().await
method, or theExecResult::exit_code().await
command waits before returning the code.The text was updated successfully, but these errors were encountered: