From bd6c099453fc56896397bb02599e91c7a7b7b57d Mon Sep 17 00:00:00 2001 From: Joran Dirk Greef Date: Wed, 18 May 2016 12:51:54 +0200 Subject: [PATCH] Fix applet path to handle spaces --- index.js | 4 +++- test.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 774245d..9141f7f 100644 --- a/index.js +++ b/index.js @@ -275,7 +275,9 @@ function MacOpen(instance, end) { var binary = Node.path.join(instance.path, 'Contents', 'MacOS', 'applet'); // We must set the cwd so that the AppleScript can find the shell scripts. 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) { diff --git a/test.js b/test.js index e8821c3..7e3c8b1 100644 --- a/test.js +++ b/test.js @@ -18,7 +18,7 @@ kill( function() { var options = { icns: icns(), - name: 'Chess' + name: 'Sudo Prompt' }; var command = 'echo hello'; console.log('sudo.exec(' + JSON.stringify(command) + ', ' + JSON.stringify(options) + ')');