Sep-25-2018, 07:29 AM
I am trying to run some commands on some machine which i am connecting through rsh command(cant use ssh here).
Through subprocess.check_call function, i am executing the command & expecting check_call to exit with exception when exit status of my " cd /libs/ " command fails.
Because of which even in command failure case no error from check_call function, as it is getting rsh exit status which will be 0.
So, how to get the exit status of the command here?
And also how to make check_call fail based on my command exit status?
Through subprocess.check_call function, i am executing the command & expecting check_call to exit with exception when exit status of my " cd /libs/ " command fails.
with open('logs.txt','w') as outstream: subprocess.check_call("rsh bldr 'cd /libs/' ", shell=True,stdout=outstream)But here rsh returns only its exit status and not the command its executing.
Because of which even in command failure case no error from check_call function, as it is getting rsh exit status which will be 0.
So, how to get the exit status of the command here?
And also how to make check_call fail based on my command exit status?