2.4isms for bzr

John A Meinel john at arbash-meinel.com
Tue Jul 26 17:42:05 BST 2005


Aaron Bentley wrote:

One small thing, you don't have to call "process.wait()" after 
process.communicate() because communicate already waits for the process. 
You can just use process.returncode

John
=:->

+
+def write_to_cmd(args, input=""):
+    process = Popen(args, bufsize=len(input), stdin=PIPE, stdout=PIPE,
+                    stderr=PIPE, close_fds=True)
+    stdout, stderr = process.communicate(input)
+    status = process.wait()
+    if status < 0:
+        raise Exception("%s killed by signal %i" (args[0], -status))
+    return stdout, stderr, status
+

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050726/505e48b3/attachment.pgp 


More information about the bazaar mailing list