Fix applet path to handle spaces
This commit is contained in:
parent
d3cb072cff
commit
bd6c099453
2 changed files with 4 additions and 2 deletions
4
index.js
4
index.js
|
@ -275,7 +275,9 @@ function MacOpen(instance, end) {
|
||||||
var binary = Node.path.join(instance.path, 'Contents', 'MacOS', 'applet');
|
var binary = Node.path.join(instance.path, 'Contents', 'MacOS', 'applet');
|
||||||
// We must set the cwd so that the AppleScript can find the shell scripts.
|
// We must set the cwd so that the AppleScript can find the shell scripts.
|
||||||
var options = { cwd: Node.path.dirname(binary) };
|
var options = { cwd: Node.path.dirname(binary) };
|
||||||
Node.child.exec(binary, options, end);
|
// We use the relative path rather than the absolute path. The instance.path
|
||||||
|
// may contain spaces which the cwd can handle, but which exec() cannot.
|
||||||
|
Node.child.exec('./' + Node.path.basename(binary), options, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
function MacPropertyList(instance, end) {
|
function MacPropertyList(instance, end) {
|
||||||
|
|
2
test.js
2
test.js
|
@ -18,7 +18,7 @@ kill(
|
||||||
function() {
|
function() {
|
||||||
var options = {
|
var options = {
|
||||||
icns: icns(),
|
icns: icns(),
|
||||||
name: 'Chess'
|
name: 'Sudo Prompt'
|
||||||
};
|
};
|
||||||
var command = 'echo hello';
|
var command = 'echo hello';
|
||||||
console.log('sudo.exec(' + JSON.stringify(command) + ', ' + JSON.stringify(options) + ')');
|
console.log('sudo.exec(' + JSON.stringify(command) + ', ' + JSON.stringify(options) + ')');
|
||||||
|
|
Loading…
Reference in a new issue