test: fix `test-setproctitle` status when `ps` is not available · nodejs/node@fe86bc6

Original file line numberDiff line numberDiff line change

@@ -4,7 +4,7 @@ const common = require('../common');

44

const { isMainThread } = require('worker_threads');

55
66

// FIXME add sunos support

7-

if (common.isSunOS || common.isIBMi) {

7+

if (common.isSunOS || common.isIBMi || common.isWindows) {

88

common.skip(`Unsupported platform [${process.platform}]`);

99

}

1010

@@ -25,15 +25,10 @@ assert.notStrictEqual(process.title, title);

2525

process.title = title;

2626

assert.strictEqual(process.title, title);

2727
28-

// Test setting the title but do not try to run `ps` on Windows.

29-

if (common.isWindows) {

30-

common.skip('Windows does not have "ps" utility');

31-

}

32-
3328

try {

3429

execSync('command -v ps');

3530

} catch (err) {

36-

if (err.status === 1) {

31+

if (err.status === 1 || err.status === 127) {

3732

common.skip('The "ps" utility is not available');

3833

}

3934

throw err;

@@ -53,5 +48,5 @@ exec(cmd, common.mustSucceed((stdout, stderr) => {

5348

title += ` (${path.basename(process.execPath)})`;

5449
5550

// Omitting trailing whitespace and \n

56-

assert.strictEqual(stdout.replace(/\s+$/, '').endsWith(title), true);

51+

assert.ok(stdout.trimEnd().endsWith(title));

5752

}));