mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.1 KiB
35 lines
1.1 KiB
10 years ago
|
'use strict';
|
||
13 years ago
|
// Original test written by Jakub Lekstan <kuebzky@gmail.com>
|
||
|
|
||
|
// FIXME add sunos support
|
||
12 years ago
|
if ('linux freebsd darwin'.indexOf(process.platform) === -1) {
|
||
10 years ago
|
console.log(`1..0 # Skipped: Unsupported platform [${process.platform}]`);
|
||
10 years ago
|
return;
|
||
13 years ago
|
}
|
||
|
|
||
9 years ago
|
require('../common');
|
||
13 years ago
|
var assert = require('assert');
|
||
|
var exec = require('child_process').exec;
|
||
10 years ago
|
var path = require('path');
|
||
13 years ago
|
|
||
12 years ago
|
// The title shouldn't be too long; libuv's uv_set_process_title() out of
|
||
|
// security considerations no longer overwrites envp, only argv, so the
|
||
|
// maximum title length is possibly quite short.
|
||
|
var title = 'testme';
|
||
13 years ago
|
|
||
|
assert.notEqual(process.title, title);
|
||
|
process.title = title;
|
||
|
assert.equal(process.title, title);
|
||
|
|
||
|
exec('ps -p ' + process.pid + ' -o args=', function(error, stdout, stderr) {
|
||
|
assert.equal(error, null);
|
||
|
assert.equal(stderr, '');
|
||
12 years ago
|
|
||
|
// freebsd always add ' (procname)' to the process title
|
||
10 years ago
|
if (process.platform === 'freebsd')
|
||
|
title += ` (${path.basename(process.execPath)})`;
|
||
12 years ago
|
|
||
13 years ago
|
// omitting trailing whitespace and \n
|
||
|
assert.equal(stdout.replace(/\s+$/, ''), title);
|
||
13 years ago
|
});
|