[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnu-arch-users] Feature request: dollar sign in file names...
From: |
Colin Walters |
Subject: |
Re: [Gnu-arch-users] Feature request: dollar sign in file names... |
Date: |
Thu, 26 Feb 2004 21:32:46 -0500 |
On Wed, 2004-02-25 at 18:29, Charles Duffy wrote:
> Oops.
>
> Right now I'm unable to commit to my archives (lost my gpg private key,
> haven't finished looking in all the places it might be recoverable from
> before generating a new one), but I'm putting that on my mental
> stufftofix list as soon as that's resolved.
For running commands in Python without going through a shell, you might
find this function I wrote for arch-pqm useful:
def popen_noshell(cmd, *args):
(stdin, stdout) = os.pipe()
pid = os.fork()
if pid == 0:
os.close(stdin)
os.dup2(stdout, 1)
os.dup2(stdout, 2)
os.execvp(cmd, [cmd] + list(args))
os.exit(1)
os.close(stdout)
output = os.fdopen(stdin).readlines()
(pid, status) = os.waitpid(pid, 0)
msg = ''
if not (status is None or (os.WIFEXITED(status) and os.WEXITSTATUS(status)
== 0)):
if os.WIFEXITED(status):
msg = "%s exited with error code %d" % (cmd,
os.WEXITSTATUS(status),)
elif os.WIFSTOPPED(status):
msg = "%s stopped unexpectedly with signal %d" % (cmd,
os.WSTOPSIG(status),)
elif os.WIFSIGNALED(status):
msg = "%s died with signal %d" % (cmd, os.WTERMSIG(status),)
return (status, msg, output)
signature.asc
Description: This is a digitally signed message part