mirror of
https://github.com/torvalds/linux.git
synced 2024-11-25 21:51:40 +00:00
tools/kvm_stat: suppress usage information on command line errors
Errors while parsing the '-g' command line argument result in display of usage information prior to the error message. This is a bit confusing, as the command line is syntactically correct. To reproduce, run 'kvm_stat -g' and specify a non-existing or inactive guest. Signed-off-by: Stefan Raspl <raspl@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
08e20a6300
commit
822cfe3e48
@ -1453,16 +1453,13 @@ Press any other key to refresh statistics immediately.
|
|||||||
try:
|
try:
|
||||||
pids = Tui.get_pid_from_gname(val)
|
pids = Tui.get_pid_from_gname(val)
|
||||||
except:
|
except:
|
||||||
raise optparse.OptionValueError('Error while searching for guest '
|
sys.exit('Error while searching for guest "{}". Use "-p" to '
|
||||||
'"{}", use "-p" to specify a pid '
|
'specify a pid instead?'.format(val))
|
||||||
'instead'.format(val))
|
|
||||||
if len(pids) == 0:
|
if len(pids) == 0:
|
||||||
raise optparse.OptionValueError('No guest by the name "{}" '
|
sys.exit('Error: No guest by the name "{}" found'.format(val))
|
||||||
'found'.format(val))
|
|
||||||
if len(pids) > 1:
|
if len(pids) > 1:
|
||||||
raise optparse.OptionValueError('Multiple processes found (pids: '
|
sys.exit('Error: Multiple processes found (pids: {}). Use "-p" '
|
||||||
'{}) - use "-p" to specify a pid '
|
'to specify the desired pid'.format(" ".join(pids)))
|
||||||
'instead'.format(" ".join(pids)))
|
|
||||||
parser.values.pid = pids[0]
|
parser.values.pid = pids[0]
|
||||||
|
|
||||||
optparser = optparse.OptionParser(description=description_text,
|
optparser = optparse.OptionParser(description=description_text,
|
||||||
|
Loading…
Reference in New Issue
Block a user