[PATCH 1/3] example: Fix argument handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
---
 examples/domain-events/events-python/event-test.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/domain-events/events-python/event-test.py b/examples/domain-events/events-python/event-test.py
index 76fda2b..9018366 100644
--- a/examples/domain-events/events-python/event-test.py
+++ b/examples/domain-events/events-python/event-test.py
@@ -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"
 
-- 
1.7.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]