with util.ChangeDirectory("math"):
shell.call("make")
try:
+ dbpass_fd, out_fd = os.pipe()
+ os.write(out_fd, options.dsn.password)
+ os.close(out_fd)
+ pass_fd, out_fd = os.pipe()
+ os.write(out_fd, options.admin_password)
+ os.close(out_fd)
+
result = shell.eval(
"php", "-c", ".", "maintenance/install.php",
"--dbname", options.dsn.database,
- "--dbpass", options.dsn.password,
+ "--dbpassfile", "php://fd/%d" % (dbpass_fd,),
"--dbserver", options.dsn.host,
"--dbuser", options.dsn.username,
"--email", options.email,
- "--pass", options.admin_password,
+ "--passfile", "php://fd/%d" % (pass_fd,),
"--server", "https://" + options.web_host,
"--scriptpath", options.web_path,
options.title, options.admin_name,
- log=True)
+ log=True,
+ close_fds=False,
+ )
except shell.CallError as e:
raise app.RecoverableInstallFailure(["Install script returned non-zero exit code\nSTDOUT: %s\nSTDERR: %s" % (e.stdout, e.stderr)])
logging.debug("Install script output:\n\n" + result)
kwargs.setdefault("stdin", subprocess.PIPE)
kwargs.setdefault("stderr", subprocess.PIPE)
kwargs.setdefault("addenv", None)
+ kwargs.setdefault("close_fds", True)
msg = "Running `" + ' '.join(args) + "`"
if kwargs["strip"] and not kwargs["log"] is True or kwargs["log"] is False:
logging.debug(msg)
env = None
if kwargs["addenv"]:
env = dict(os.environ.items() + kwargs["addenv"].items())
+ close_fds = kwargs["close_fds"]
# XXX: There is a possible problem here where we can fill up
# the kernel buffer if we have 64KB of data. This shouldn't
# normally be a problem, and the fix for such case would be to write to
# waitpid() pump to a select() pump, creating a pipe to
# ourself, and then setting up a SIGCHILD handler to write a single
# byte to the pipe to get us out of select() when a subprocess exits.
- proc = subprocess.Popen(args, stdout=stdout, stderr=stderr, stdin=stdin, cwd=self.cwd, env=env)
+ proc = subprocess.Popen(args, stdout=stdout, stderr=stderr, stdin=stdin, cwd=self.cwd, env=env, close_fds=close_fds)
if self._async(proc, args, **kwargs):
return proc
stdout, stderr = proc.communicate(kwargs["input"])