+def Popen_quirky(cmd, **args):
+ '''
+ Runs cmd via subprocess.Popen; and if that fails, puts it into the shell (/bin/sh).
+ It seems that's what executing things in bash does, and even execve. Also,
+ all so-far released versions of Gitolite get the shebang line wrong.
+ '''
+ try:
+ return subprocess.Popen(cmd, **args)
+ except OSError as e:
+ return subprocess.Popen(['/bin/sh'] + cmd, **args)
+