Test options.env
This commit is contained in:
parent
dac09e3c7b
commit
ab3a0bd981
1 changed files with 11 additions and 4 deletions
15
test.js
15
test.js
|
@ -20,16 +20,23 @@ function icns() {
|
|||
kill(
|
||||
function() {
|
||||
var options = {
|
||||
env: { 'SUDO_PROMPT_TEST_ENV': 'hello world' },
|
||||
icns: icns(),
|
||||
name: 'Electron'
|
||||
};
|
||||
var command = 'echo hello';
|
||||
if (process.platform === 'win32') {
|
||||
var expected = 'hello\r\n';
|
||||
var command = 'echo %SUDO_PROMPT_TEST_ENV%';
|
||||
var expected = 'hello world\r\n';
|
||||
} else {
|
||||
var expected = 'hello\n';
|
||||
var command = 'echo $SUDO_PROMPT_TEST_ENV';
|
||||
var expected = 'hello world\n';
|
||||
}
|
||||
console.log('sudo.exec(' + JSON.stringify(command) + ', ' + JSON.stringify(options) + ')');
|
||||
console.log(
|
||||
'sudo.exec(' +
|
||||
JSON.stringify(command) + ', ' +
|
||||
JSON.stringify(options) +
|
||||
')'
|
||||
);
|
||||
sudo.exec(command, options,
|
||||
function(error, stdout, stderr) {
|
||||
console.log('error: ' + error);
|
||||
|
|
Loading…
Reference in a new issue