diff options
Diffstat (limited to 'deps/npm/node_modules/read-cmd-shim/index.js')
-rw-r--r-- | deps/npm/node_modules/read-cmd-shim/index.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/deps/npm/node_modules/read-cmd-shim/index.js b/deps/npm/node_modules/read-cmd-shim/index.js index f565ababe4..3af2512f6c 100644 --- a/deps/npm/node_modules/read-cmd-shim/index.js +++ b/deps/npm/node_modules/read-cmd-shim/index.js @@ -4,11 +4,18 @@ var fs = require('graceful-fs') function extractPath (path, cmdshimContents) { if (/[.]cmd$/.test(path)) { return extractPathFromCmd(cmdshimContents) + } else if (/[.]ps1$/.test(path)) { + return extractPathFromPowershell(cmdshimContents) } else { return extractPathFromCygwin(cmdshimContents) } } +function extractPathFromPowershell (cmdshimContents) { + var matches = cmdshimContents.match(/"[$]basedir[/]([^"]+?)"\s+[$]args/) + return matches && matches[1] +} + function extractPathFromCmd (cmdshimContents) { var matches = cmdshimContents.match(/"%(?:~dp0|dp0%)\\([^"]+?)"\s+%[*]/) return matches && matches[1] |