]> xenbits.xensource.com Git - libvirt.git/commitdiff
example: Fix argument handling
authorPhilipp Hahn <hahn@univention.de>
Wed, 12 Oct 2011 14:54:40 +0000 (16:54 +0200)
committerEric Blake <eblake@redhat.com>
Wed, 12 Oct 2011 22:11:54 +0000 (16:11 -0600)
sys.argv contains the original command line arguments, while args only
contains the arguments not handled by getopt(). Currently this is no
problem since --help is the only command line option passable, which
terminates the process, so the code is never reached. Any option added
in the future will reveal the bug.

Signed-off-by: Philipp Hahn <hahn@univention.de>
examples/domain-events/events-python/event-test.py

index 76fda2bb4de8f71399e0b74cedbdeaddd0d7b157..9018366512a19d6375ddaaaecea344497b84f01c 100644 (file)
@@ -486,8 +486,8 @@ def main():
             usage()
             sys.exit()
 
-    if len(sys.argv) > 1:
-        uri = sys.argv[1]
+    if len(args) >= 1:
+        uri = args[0]
     else:
         uri = "qemu:///system"