Allow npm to install to a directory that doesn't yet exist
If path is specified but does not exist, create it. Fail if path is specified but is not a directory
This commit is contained in:
parent
7c263fcdad
commit
0b87bbe839
1 changed files with 4 additions and 0 deletions
|
@ -139,6 +139,10 @@ class Npm(object):
|
||||||
#If path is specified, cd into that path and run the command.
|
#If path is specified, cd into that path and run the command.
|
||||||
cwd = None
|
cwd = None
|
||||||
if self.path:
|
if self.path:
|
||||||
|
if not os.path.exists(self.path):
|
||||||
|
os.makedirs(self.path)
|
||||||
|
if not os.path.isdir(self.path):
|
||||||
|
self.module.fail_json(msg="path %s is not a directory" % self.path)
|
||||||
cwd = self.path
|
cwd = self.path
|
||||||
|
|
||||||
rc, out, err = self.module.run_command(cmd, check_rc=check_rc, cwd=cwd)
|
rc, out, err = self.module.run_command(cmd, check_rc=check_rc, cwd=cwd)
|
||||||
|
|
Loading…
Reference in a new issue