Skip to content

Commit 01edcbf

Browse files
committed
Minor patch (proper exit code-ing)
1 parent 0b93311 commit 01edcbf

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from thirdparty.six import unichr as _unichr
1919

2020
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
21-
VERSION = "1.4.5.15"
21+
VERSION = "1.4.5.16"
2222
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2323
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2424
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

sqlmap.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ def main():
238238
errMsg = getSafeExString(ex)
239239
logger.critical(errMsg)
240240

241+
os._exitcode = 1
242+
241243
raise SystemExit
242244

243245
except KeyboardInterrupt:
@@ -249,15 +251,17 @@ def main():
249251
errMsg = "exit"
250252
logger.error(errMsg)
251253

252-
except SystemExit:
253-
pass
254+
except SystemExit as ex:
255+
os._exitcode = ex.code or 0
254256

255257
except:
256258
print()
257259
errMsg = unhandledExceptionMessage()
258260
excMsg = traceback.format_exc()
259261
valid = checkIntegrity()
260262

263+
os._exitcode = 255
264+
261265
if any(_ in excMsg for _ in ("MemoryError", "Cannot allocate memory")):
262266
errMsg = "memory exhaustion detected"
263267
logger.critical(errMsg)

0 commit comments

Comments
 (0)