test: skip test-setproctitle
when ps
is not available
PR-URL: https://github.com/nodejs/node/pull/53104 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
19f0bcaa62
commit
e818eee5af
@ -12,7 +12,7 @@ if (!common.isMainThread)
|
|||||||
common.skip('Setting the process title from Workers is not supported');
|
common.skip('Setting the process title from Workers is not supported');
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
const exec = require('child_process').exec;
|
const { exec, execSync } = require('child_process');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
// The title shouldn't be too long; libuv's uv_set_process_title() out of
|
// The title shouldn't be too long; libuv's uv_set_process_title() out of
|
||||||
@ -28,6 +28,15 @@ assert.strictEqual(process.title, title);
|
|||||||
if (common.isWindows)
|
if (common.isWindows)
|
||||||
common.skip('Windows does not have "ps" utility');
|
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
|
// To pass this test on alpine, since Busybox `ps` does not
|
||||||
// support `-p` switch, use `ps -o` and `grep` instead.
|
// support `-p` switch, use `ps -o` and `grep` instead.
|
||||||
const cmd = common.isLinux ?
|
const cmd = common.isLinux ?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user