Skip to content

Commit

Permalink
test: skip test-setproctitle when ps is not available
Browse files Browse the repository at this point in the history
PR-URL: #53104
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
aduh95 authored and targos committed Jun 1, 2024
1 parent ca655b6 commit 9a47792
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test/parallel/test-setproctitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if (!common.isMainThread)
common.skip('Setting the process title from Workers is not supported');

const assert = require('assert');
const exec = require('child_process').exec;
const { exec, execSync } = require('child_process');
const path = require('path');

// The title shouldn't be too long; libuv's uv_set_process_title() out of
Expand All @@ -28,6 +28,15 @@ assert.strictEqual(process.title, title);
if (common.isWindows)
common.skip('Windows does not have "ps" utility');

try {
execSync('command -v ps');
} catch (err) {
if (err.status === 1) {
common.skip('The "ps" utility is not available');
}
throw err;
}

// To pass this test on alpine, since Busybox `ps` does not
// support `-p` switch, use `ps -o` and `grep` instead.
const cmd = common.isLinux ?
Expand Down

0 comments on commit 9a47792

Please sign in to comment.