diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-09-01 09:51:27 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2012-10-16 11:07:30 -0500 |
commit | 61173c1b58efa79c0ba6b08348d2796a249d0186 (patch) | |
tree | 00ebf544db18942e2a1ecfc5e5fa16931127d38f /wiki-to-help/executor.py | |
parent | convert insert->object->ole object to .ui helpids (diff) | |
download | help-61173c1b58efa79c0ba6b08348d2796a249d0186.tar.gz help-61173c1b58efa79c0ba6b08348d2796a249d0186.zip |
move help structure one directory up
Change-Id: Ie970e39fbb6795a92d9fdd13510409d7dcd071bc
Diffstat (limited to 'wiki-to-help/executor.py')
-rw-r--r-- | wiki-to-help/executor.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/wiki-to-help/executor.py b/wiki-to-help/executor.py new file mode 100644 index 0000000000..464ec222e4 --- /dev/null +++ b/wiki-to-help/executor.py @@ -0,0 +1,21 @@ +import subprocess, os + +class Executor(object): + def __init__(self,showErr=True,showOutput=True,showCmd=False): + self.showCmd=showCmd + if showErr: self.stderr = None + else: self.stderr=open(os.devnull,"w") + if showOutput: self.stdout = None + else: self.stdout=open(os.devnull,"w") + + def __call__(self,*cmd): + """ + Execute a program, e.g. Executor()("/bin/ls","/home") + @cmd Command, args + @return boolean True if succeed + """ + if self.showCmd: + print cmd + return (subprocess.Popen(list(cmd),stderr=self.stderr, + stdout=self.stdout).wait() == 0) + |