Skip to content

Commit

Permalink
Escape ^ character on Windows
Browse files Browse the repository at this point in the history
This is important especially for the URL case.

Co-authored-by: Max Schaefer <[email protected]>
  • Loading branch information
kevinbackhouse and Max Schaefer authored Aug 29, 2020
1 parent 3deb561 commit 77fd779
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/opener.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ module.exports = function opener(args, options, callback) {
// 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
//
// Additionally, on Windows ampersand needs to be escaped when passed to "start"
// Additionally, on Windows ampersand and caret need to be escaped when passed to "start"
args = args.map(function (value) {
return value.replace(/&/g, "^&");
return value.replace(/[&^]/g, "^$&");
});
args = ["/c", "start", "\"\""].concat(args);
}
Expand Down

0 comments on commit 77fd779

Please sign in to comment.