I have a var exitcd
that executes a command. Its supposed to get the exit code
of running the command and then fall into one of the if/elif conditions based on that exit code.
However, it is failing stating general error occurred
when the -d
being used is telling me it should be hitting elif exitcd == 3
but that is not occurring.
exitcd=os.popen('cmd test ').read()
print(exitcd)
#print("retcode was {}".format(retcode))
#not found
if exitcd == 0:
continue
# found
elif exitcd == 1:
subprocess.Popen('cmd test -d --insecure --all-projects --json >> a_dir_res_storage')
subprocess.Popen('cmd monitor --all-projects')
continue
#error with command
elif exitcd == 2:
print('error with command')
continue
#failure to find project manifest
elif exitcd == 3:
print('error with find manifests for {}'.format(storage+'/'+a_dir))
continue
else:
print('general error occurred.')
what am i doing wrong here?
Thanks