From d21a3ffac5e1c92c60cd8c1fca23aff759bcd293 Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 12 Sep 2012 19:48:53 -0700 Subject: [PATCH 1/2] If options is a function, then it's a callback --- opener.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/opener.js b/opener.js index b493fa6..0247849 100644 --- a/opener.js +++ b/opener.js @@ -14,6 +14,11 @@ function opener(args, options, callback) { args = [args]; } + if (typeof options === "function") { + callback = options; + options = {}; + } + if (process.platform === "win32") { // On Windows, we really want to use the "start" command. But, the rules regarding arguments with spaces, and // escaping them with quotes, can get really arcane. So the easiest way to deal with this is to pass off the From dec13194d81b03278c153cac769908d39ccf5d12 Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 12 Sep 2012 19:49:15 -0700 Subject: [PATCH 2/2] Allow setting options.command to override default --- opener.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/opener.js b/opener.js index 0247849..5cdfd72 100644 --- a/opener.js +++ b/opener.js @@ -19,6 +19,15 @@ function opener(args, options, callback) { options = {}; } + if (options && typeof options === "object" && options.command) { + if (process.platform === "win32") { + // *always* use cmd on windows + args = [options.command].concat(args); + } else { + cmd = options.command; + } + } + if (process.platform === "win32") { // On Windows, we really want to use the "start" command. But, the rules regarding arguments with spaces, and // escaping them with quotes, can get really arcane. So the easiest way to deal with this is to pass off the