opener
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -8,4 +8,4 @@ #!/usr/bin/env node | ||
function opener(args, options, callback) { | ||
// http://stackoverflow.com/q/1480971/3191 | ||
var command = process.platform === "win32" ? "start" : | ||
// http://stackoverflow.com/q/1480971/3191, but see below for Windows. | ||
var command = process.platform === "win32" ? "cmd" : | ||
process.platform === "darwin" ? "open" : | ||
@@ -18,11 +18,13 @@ "xdg-open"; | ||
if (process.platform === "win32" && args[0].indexOf(" ") !== -1) { | ||
// Windows executables whose paths contain spaces need to be quoted. | ||
args[0] = '"' + args[0]; | ||
// But, if you double-quote the first parameter, then `start` it will interpret it as a window title, so you | ||
// need to add a dummy window title: http://stackoverflow.com/q/154075/#154090 | ||
args.unshift('""'); | ||
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 | ||
// responsibility to "cmd /c", which has that logic built in. | ||
// | ||
// Furthermore, if "cmd /c" double-quoted the first parameter, then "start" will interpret it as a window title, | ||
// so we need to add a dummy empty-string window title: http://stackoverflow.com/a/154090/3191 | ||
args = ["/c", "start", '""'].concat(args); | ||
} | ||
childProcess.exec(command + " " + args.join(" "), options, callback); | ||
childProcess.execFile(command, args, options, callback); | ||
} | ||
@@ -29,0 +31,0 @@ |
{ | ||
"name": "opener", | ||
"description": "Opens stuff, like webpages and files and executables, cross-platform", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"author": "Domenic Denicola <domenic@domenicdenicola.com> (http://domenicdenicola.com)", | ||
@@ -6,0 +6,0 @@ "license": "WTFPL", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
3658
33
1