Commit 5b9b5fd0 by Michael DeHaan

Merge pull request #6612 from willthames/npm_fix_nonexistent_path

Allow npm to install to a directory that doesn't yet exist
parents b204419a 7272877d
......@@ -139,6 +139,10 @@ class Npm(object):
#If path is specified, cd into that path and run the command.
cwd = None
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
rc, out, err = self.module.run_command(cmd, check_rc=check_rc, cwd=cwd)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment