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(
|
kill(
|
||||||
function() {
|
function() {
|
||||||
var options = {
|
var options = {
|
||||||
|
env: { 'SUDO_PROMPT_TEST_ENV': 'hello world' },
|
||||||
icns: icns(),
|
icns: icns(),
|
||||||
name: 'Electron'
|
name: 'Electron'
|
||||||
};
|
};
|
||||||
var command = 'echo hello';
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
var expected = 'hello\r\n';
|
var command = 'echo %SUDO_PROMPT_TEST_ENV%';
|
||||||
|
var expected = 'hello world\r\n';
|
||||||
} else {
|
} 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,
|
sudo.exec(command, options,
|
||||||
function(error, stdout, stderr) {
|
function(error, stdout, stderr) {
|
||||||
console.log('error: ' + error);
|
console.log('error: ' + error);
|
||||||
|
|
Loading…
Reference in a new issue