When calling chimera ls /path/to/directory from a script (in this case python using the subprocess module sh) it does return a 0 exit code even if the directory requested does not exist:
>>> output=sh.chimera('ls','/pnfs/bwlts/bwda',_return_cmd=True)
>>> output.exit_code
0
>>> output
No such file or directory: /pnfs/bwlts/bwda
This behaviour is unexpected as the normal system ls behaves differently:
>>> sh.ls('/bumble')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/.pyvenvs/adminscripts/lib64/python3.11/site-packages/sh/__init__.py", line 1580, in __call__
rc = self.__class__.RunningCommandCls(cmd, call_args, stdin, stdout, stderr)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.pyvenvs/adminscripts/lib64/python3.11/site-packages/sh/__init__.py", line 734, in __init__
self.wait()
File "/root/.pyvenvs/adminscripts/lib64/python3.11/site-packages/sh/__init__.py", line 796, in wait
self.handle_command_exit_code(exit_code)
File "/root/.pyvenvs/adminscripts/lib64/python3.11/site-packages/sh/__init__.py", line 823, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_2:
RAN: /usr/bin/ls /bumble
STDOUT:
STDERR:
/usr/bin/ls: cannot access '/bumble': No such file or directory
Chimera returning a 0 exit code here also makes it difficult to use it in scripting processes as it does not notify the parent process that something unexpected happened and that it should trigger error handling procedures.
Therefore I would like to ask if it is intended behaviour that chimera returns with exit code 0 in this case.
When calling
chimera ls /path/to/directoryfrom a script (in this case python using the subprocess module sh) it does return a 0 exit code even if the directory requested does not exist:This behaviour is unexpected as the normal system ls behaves differently:
Chimera returning a 0 exit code here also makes it difficult to use it in scripting processes as it does not notify the parent process that something unexpected happened and that it should trigger error handling procedures.
Therefore I would like to ask if it is intended behaviour that chimera returns with exit code 0 in this case.