From 1775dbe176fe284a9baa8697f600f03e9b8dabbc Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 17 Mar 2009 08:03:04 -0700 Subject: [PATCH] Set forall environment variables to empty string if None If the value obtained is None we now set the variable to '' instead, in an attempt to make execve() happier about our 3rd argument, the env dictionary. Signed-off-by: Shawn O. Pearce --- subcmds/forall.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/subcmds/forall.py b/subcmds/forall.py index bc0d455d..6dff252d 100644 --- a/subcmds/forall.py +++ b/subcmds/forall.py @@ -82,16 +82,21 @@ not redirected. rc = 0 for project in self.GetProjects(args): env = dict(os.environ.iteritems()) - env['REPO_PROJECT'] = project.name - env['REPO_PATH'] = project.relpath - env['REPO_REMOTE'] = project.remote.name - env['REPO_LREV'] = project\ + def setenv(name, val): + if val is None: + val = '' + env[name] = val + + setenv('REPO_PROJECT', project.name) + setenv('REPO_PATH', project.relpath) + setenv('REPO_REMOTE', project.remote.name) + setenv('REPO_LREV', project\ .GetRemote(project.remote.name)\ - .ToLocal(project.revision) - env['REPO_RREV'] = project.revision + .ToLocal(project.revision)) + setenv('REPO_RREV', project.revision) if mirror: - env['GIT_DIR'] = project.gitdir + setenv('GIT_DIR', project.gitdir) cwd = project.gitdir else: cwd = project.worktree