samba-tool: make sure we exit with an error on a bad command
authorAndrew Tridgell <tridge@samba.org>
Thu, 21 Jul 2011 00:29:21 +0000 (10:29 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 21 Jul 2011 02:58:01 +0000 (04:58 +0200)
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Thu Jul 21 04:58:01 CEST 2011 on sn-devel-104

source4/scripting/python/samba/netcmd/__init__.py

index e5d20ef3015cad90f5221aea1e740c485cb768f4..f8371e7a7d3b9d85e12965b2f90b82ac82537e28 100644 (file)
@@ -82,6 +82,7 @@ class Command(object):
 
         if force_traceback or samba.get_debug_level() >= 3:
             traceback.print_tb(etraceback)
+        sys.exit(1)
 
     outf = sys.stdout
 
@@ -171,7 +172,7 @@ class SuperCommand(Command):
         '''display a command error'''
 
         print >>sys.stderr, "ERROR: %s" % (msg)
-        return -1
+        sys.exit(1)
 
     def usage(self, myname, subcommand=None, *args):
         if subcommand is None or not subcommand in self.subcommands: