Fix applet path to handle spaces

This commit is contained in:
Joran Dirk Greef 2016-05-18 12:51:54 +02:00
parent d3cb072cff
commit bd6c099453
2 changed files with 4 additions and 2 deletions

View file

@ -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) {

View file

@ -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) + ')');