We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f2c7f46 commit fc35579Copy full SHA for fc35579
lib/spawnify.js
@@ -29,7 +29,9 @@
29
30
assert(command, 'command could not be empty!');
31
32
- if (!options)
+ if (options && options.cwd)
33
+ options.cwd = parseDir(options.cwd);
34
+ else
35
options = {
36
cwd: process.cwd()
37
};
@@ -39,6 +41,20 @@
39
41
return spawnify;
40
42
43
44
+ function parseDir(dir) {
45
+ var HOME_WIN = process.env.HOMEPATH,
46
+ HOME_UNIX = process.env.HOME,
47
+ HOME = HOME_WIN || HOME_UNIX,
48
+ cwd = process.cwd();
49
+
50
+ assert(dir, 'dir should be string!');
51
52
+ dir = dir.replace(/^~/, HOME)
53
+ .replace(/^\./, cwd);
54
55
+ return dir;
56
+ }
57
58
function Spawnify(command, options) {
59
var self = this;
60
0 commit comments