Skip to content

Commit 36dd856

Browse files
aduh95richardlau
authored andcommitted
test: fix test-setproctitle status when ps is not available
PR-URL: #59523 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent 3cfec82 commit 36dd856

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

‎test/parallel/test-setproctitle.js‎

Lines changed: 3 additions & 8 deletions
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
throwerr;
@@ -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
}));

0 commit comments

Comments
 (0)