scripts/trace: suppress KeyboardInterrupt and BrokenPipe exceptions

The stack trace is no longer printed if a user presses <C-c> while the
script is running or pipes its output to tools such as head or less.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I0951c38d914986b5c9bf2ee98bcd046f0e957ff0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9441
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
This commit is contained in:
Konrad Sztyber 2021-09-02 14:13:07 +02:00 committed by Tomasz Zawadzki
parent bc71c2e6d7
commit 364dbc8f48

View File

@ -601,4 +601,7 @@ if __name__ == '__main__':
os.environ['SPDK_BPF_TRACE_PY'] = '1'
os.execv(sys.argv[0], sys.argv)
else:
main(sys.argv[1:])
try:
main(sys.argv[1:])
except (KeyboardInterrupt, BrokenPipeError):
pass