output stderr when running ssh commands#406
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. |
shuffle-tools/1.2.0/src/app.py
Outdated
| 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.
Shouldn't stderr.read() and stdout.read() be try-caught? Those can easily crash. The decode as well.
|
Sorry, for the delay totally forgot about this, will fix it today. |
|
ready for review @frikky |
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.