Skip to content

Chimera ls returns a success exit code while returning an error message #8129

@nManger

Description

@nManger

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ChimeraProblems with Chimera namespaceenhancementA request that enhances existing behaviour

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions