Skip to content

Commit 2b07d01

Browse files
aduh95marco-ippolito
authored andcommitted
test: skip test-setproctitle when ps is not available
PR-URL: #53104 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 9aa896e commit 2b07d01

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/parallel/test-setproctitle.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if (!common.isMainThread)
1212
common.skip('Setting the process title from Workers is not supported');
1313

1414
const assert = require('assert');
15-
const exec = require('child_process').exec;
15+
const { exec, execSync } = require('child_process');
1616
const path = require('path');
1717

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

31+
try {
32+
execSync('command -v ps');
33+
} catch (err) {
34+
if (err.status === 1) {
35+
common.skip('The "ps" utility is not available');
36+
}
37+
throw err;
38+
}
39+
3140
// To pass this test on alpine, since Busybox `ps` does not
3241
// support `-p` switch, use `ps -o` and `grep` instead.
3342
const cmd = common.isLinux ?

0 commit comments

Comments
 (0)