The following command works fine on the shell
ssh hostname 'pgrep -fn "java -cp /strbase/apps/App"'
However not in the python subprocess, I have my array as follows
cmd_array = ['ssh', 'hostname', "'pgrep", '-fn', '"java', '-cp', '/strbase/apps/App"\'']
However I get no output.
I am trying below:
process = subprocess.Popen(
cmd_array, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
However
stdout
evalutes to an empty string, it should give me back a number. Why is this? It works fine in the shell?