Avoid #12321 by creating environment before switching directories.

This commit is contained in:
Josh Matthews 2016-07-07 12:06:54 -04:00
parent 906b7b33ef
commit a2bc9d7775

View file

@ -174,23 +174,24 @@ class MachCommands(CommandBase):
description='upgrade wptrunner.', description='upgrade wptrunner.',
category='devenv') category='devenv')
def upgrade_wpt_runner(self): def upgrade_wpt_runner(self):
env = self.build_env()
with cd(path.join(self.context.topdir, 'tests', 'wpt', 'harness')): with cd(path.join(self.context.topdir, 'tests', 'wpt', 'harness')):
code = call(["git", "init"], env=self.build_env()) code = call(["git", "init"], env=env)
if code: if code:
return code return code
# No need to report an error if this fails, as it will for the first use # No need to report an error if this fails, as it will for the first use
call(["git", "remote", "rm", "upstream"], env=self.build_env()) call(["git", "remote", "rm", "upstream"], env=env)
code = call( code = call(
["git", "remote", "add", "upstream", "https://github.com/w3c/wptrunner.git"], env=self.build_env()) ["git", "remote", "add", "upstream", "https://github.com/w3c/wptrunner.git"], env=env)
if code: if code:
return code return code
code = call(["git", "fetch", "upstream"], env=self.build_env()) code = call(["git", "fetch", "upstream"], env=env)
if code: if code:
return code return code
code = call(["git", "reset", "--hard", "remotes/upstream/master"], env=self.build_env()) code = call(["git", "reset", "--hard", "remotes/upstream/master"], env=env)
if code: if code:
return code return code
code = call(["rm", "-rf", ".git"], env=self.build_env()) code = call(["rm", "-rf", ".git"], env=env)
if code: if code:
return code return code
return 0 return 0