test: fix bug in setproctitle test
authorBen Noordhuis <info@bnoordhuis.nl>
Sat, 15 Oct 2011 00:05:33 +0000 (02:05 +0200)
committerBen Noordhuis <info@bnoordhuis.nl>
Sat, 15 Oct 2011 00:07:57 +0000 (02:07 +0200)
Output from `ps` may contain trailing whitespace, trim it.

test/simple/test-setproctitle.js

index 47635be1cd9a33c548ab1108cd55f515499d5fa7..4276d2d3663285a491e60b005cdff3ebd41f963b 100644 (file)
@@ -39,6 +39,6 @@ assert.equal(process.title, title);
 exec('ps -p ' + process.pid + ' -o args=', function(error, stdout, stderr) {
   assert.equal(error, null);
   assert.equal(stderr, '');
-  // omitting trailing \n
-  assert.equal(stdout.substring(0, stdout.length - 1), title);
+  // omitting trailing whitespace and \n
+  assert.equal(stdout.replace(/\s+$/, ''), title);
 });