From c72b71f2e1b51c6e9a95a32f8688ef831236d64b Mon Sep 17 00:00:00 2001 From: Ross Zurowski Date: Tue, 10 May 2016 00:04:56 -0400 Subject: [PATCH] Add support for Node 6.0 --- lib/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 1f0cca3..8cedfc2 100644 --- a/lib/index.js +++ b/lib/index.js @@ -20,8 +20,13 @@ var bufferStream = function(stream){ var execute = function ( path, script, vars, cb ) { if ( cb === undefined ) cb = vars; + if ( typeof path !== 'undefined') { + opts = { cwd: dirname(path) } + } else { + opts = {} + } - var cp = spawn("osascript", ["-ss", "-"], { cwd: dirname(path) }); + var cp = spawn("osascript", ["-ss", "-"], opts); var outBuffer = bufferStream(cp.stdout); var errBuffer = bufferStream(cp.stderr);