-
-
Notifications
You must be signed in to change notification settings - Fork 111
output stderr when running ssh commands #406
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
base: master
Are you sure you want to change the base?
Conversation
Don't return at that point at all, I'd say. STDOUT may still have data, so you just add it as an additional field to the same dictionary (e.g. error_logs). |
bump |
Hey, sorry — I was off last week. I've made the change. |
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.
(:
shuffle-tools/1.2.0/src/app.py
Outdated
except Exception as e: | ||
return {"success":"false","message":str(e)} | ||
|
||
return {"success":"true","output": stdout.read().decode(errors='ignore')} | ||
return {"success":"true","output": stdout.read().decode(errors='ignore'), "error_log": stderr.read().decode(errors='ignore')} |
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.
Shouldn't stderr.read() and stdout.read() be try-caught? Those can easily crash. The decode as well.
I added logic to return an error message if we get anything in stderr.
I'm unsure whether the result should be marked as success: false or true, since the SSH connection was successful, but the command execution on the remote shell failed.
Also yes, do let me know If I should also return the stdout if there is any when we actually return in this case?
This makes it easier for user to know what went wrong.