Bug 1458588 - Create objdir/tmp if it doesn't exist during mach run;r=ahal draft
authorBrian Grinstead <bgrinstead@mozilla.com>
Wed, 02 May 2018 09:26:13 -0700
changeset 790731 b26f54b6ac4b0d9020fb803f9fb8c51ea51f511d
parent 790721 f877359308b17e691209e1afb7193b8e86f175ce
push id108559
push userbgrinstead@mozilla.com
push dateWed, 02 May 2018 16:26:53 +0000
reviewersahal
bugs1458588
milestone61.0a1
Bug 1458588 - Create objdir/tmp if it doesn't exist during mach run;r=ahal This fixes `./mach run --temp-profile` after a clobber. MozReview-Commit-ID: 7xoH5RCSpXx
python/mozbuild/mozbuild/mach_commands.py
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -893,20 +893,24 @@ class RunProgram(MachCommandBase):
                    'browser.shell.checkDefaultBrowser': False,
                    'general.warnOnAboutConfig': False,
                 }
                 prefs.update(self._mach_context.settings.runprefs)
                 prefs.update([p.split('=', 1) for p in setpref])
                 for pref in prefs:
                     prefs[pref] = Preferences.cast(prefs[pref])
 
+                tmpdir = os.path.join(self.topobjdir, 'tmp')
+                if not os.path.exists(tmpdir):
+                    os.makedirs(tmpdir)
+
                 if (temp_profile):
-                    path = tempfile.mkdtemp(dir=os.path.join(self.topobjdir, 'tmp'), prefix='profile-')
+                    path = tempfile.mkdtemp(dir=tmpdir, prefix='profile-')
                 else:
-                    path = os.path.join(self.topobjdir, 'tmp', 'profile-default')
+                    path = os.path.join(tmpdir, 'profile-default')
 
                 profile = Profile(path, preferences=prefs)
                 args.append('-profile')
                 args.append(profile.profile)
 
             if not no_profile_option_given and setpref:
                 print("setpref is only supported if a profile is not specified")
                 return 1