Skip to content

Commit c5ffb08

Browse files
authored
fix: give detailed error message when ps is not installed (#482)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added a command-line check to ensure the availability of the `ps` command before executing the main logic of the status check, enhancing system stability and preventing runtime errors. - **Bug Fixes** - Improved error handling by outputting a descriptive message when the `ps` command is not found, allowing users to understand the issue clearly. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
1 parent 883ab6b commit c5ffb08

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

dpdispatcher/machines/shell.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def check_status(self, job):
7474

7575
# mark defunct process as terminated
7676
ret, stdin, stdout, stderr = self.context.block_call(
77+
r"""command -v ps >/dev/null 2>&1 || { echo >&2 "I require ps but it's not installed. Aborting."; exit 1; };"""
7778
f"if ps -p {job_id} > /dev/null && ! (ps -o command -p {job_id} | grep defunct >/dev/null) ; then echo 1; fi"
7879
)
7980
if ret != 0:

0 commit comments

Comments
 (0)