-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Stream output from launched command #40
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using unwrap
isn't a good idea. It would be better if we properly handled the error before continuing.
I seem to have made the same mistake when using String::from_utf8(output.stdout).unwrap()
But the idea is really good. Seeing the command output is very crucial, without that whats the point of the Thank you @afh! |
Thank you for pointing out that if let Ok(status) = cmd.wait() {
if let Some(code) = status.code() {
std::process::exit(code);
}
} |
I believe something like the following would work: let status = match cmd.wait() {
Ok(s) => s,
Err(e) => {
println!("{}: {}", "Error".red(), e);
exit(1);
}
};
match status.code() {
Some(code) => std::process::exit(code),
None => {
println!("{}: Child process terminated by signal", "Error".red());
std::process::exit(1);
}
} I want to be able to also print out the error message. I made the changes required and merged the pull request. Thank you @afh |
Thank you for improving this initial PR then reviewing, and merging it, very much appreciated! 😃 |
I wanted to ask you if you would be interested in being a maintainer for the project? |
Thank you for asking, @humblepenguinn, and apologies for the late response. I allowed myself an extra day to consider your request and think it through. At this point I kindly decline to be a maintainer for this project for two reasons: I'll happily continue to contribute to this project as long as the ideas flow and you find them helpful. Maybe in the future I've accumulated more knowledge about Rust and other interests have subsided freeing up time and brain cycles for me to spend on this project. |
No worries @afh, I completely understand your points and your current position. Your contributions thus far have been immensely valuable, and I appreciate your honesty about your current commitments and knowledge level. Your future ideas and contributions will be eagerly welcomed! And who knows, perhaps in the future, circumstances will change, and we can revisit the possibility of you taking on a more formal role once again 🌟 Thank you again for all that you have done for the project! |
Envio collects the output of launched commands, if the command is short-lived that is reasonable, yet if the command takes a long time and streams messages to stdout and/or stderr seeing these messages as the command runs is very helpful.
Image a simple script that prints the current date and time every second:
When launched via
envio profile -c 'sh ./clock.sh
nothing is printed to the terminal. With the changes proposed in this PR however the date and time appears every second.What are your thoughts on this, @humblepenguinn?