mirror of
https://github.com/samba-team/samba.git
synced 2025-12-13 16:23:50 +03:00
Print out a friendly message on error instead of a python exception when
calling tdb.open() Override Python's SIGINT handler so we can quit from the command line by hitting Ctrl-C.
This commit is contained in:
@@ -244,7 +244,11 @@ if len(sys.argv) != 2:
|
||||
print "Usage: gdbtool <tdbfile>"
|
||||
sys.exit(1)
|
||||
|
||||
t = tdb.open(sys.argv[1])
|
||||
try:
|
||||
t = tdb.open(sys.argv[1])
|
||||
except tdb.error, t:
|
||||
print "gtdbtool: error opening %s: %s" % (sys.argv[1], t)
|
||||
sys.exit(1)
|
||||
|
||||
# Create user interface
|
||||
|
||||
@@ -269,4 +273,10 @@ w.register_display_value_fn("PRINTERS/", convert_to_hex)
|
||||
|
||||
w.build_ui("gtdbtool: %s" % sys.argv[1])
|
||||
|
||||
# Override Python's handling of ctrl-c so we can break out of the gui
|
||||
# from the command line.
|
||||
|
||||
import signal
|
||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||
|
||||
mainloop()
|
||||
|
||||
Reference in New Issue
Block a user