scripts, test: replace exit() with sys.exit()

exit() is provided by the site module for interactive use.
Use sys.exit() which is the proper way to exit from scripts.

Assisted-by: Claude Code (claude-opus-4-6)
Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
Adrian Reber 2026-07-09 13:11:19 +00:00 committed by Radostin Stoyanov
parent 55a55d34e8
commit e0ab0dba69
3 changed files with 4 additions and 4 deletions

View file

@ -9,7 +9,7 @@ if __name__ == '__main__':
if len(sys.argv) != 1 and len(sys.argv) != 2:
print(f'usage: {sys.argv[0]} <path/to/file>')
print(f'usage: <command> | {sys.argv[0]}')
exit(1)
sys.exit(1)
input_file = sys.stdin.fileno()
if len(sys.argv) == 2:

View file

@ -7,7 +7,7 @@ import sys
def main(argv):
if len(argv) != 3:
print("Usage: magic-gen.py path/to/image.h path/to/magic.py")
exit(1)
sys.exit(1)
magic_c_header = argv[1]
magic_py = argv[2]

View file

@ -38,7 +38,7 @@ def run_task_with_own_pty(task):
fcntl.ioctl(fd_s, termios.TIOCSCTTY, 1)
os.close(fd_s)
task()
exit(0)
sys.exit(0)
os.close(fd_s)
fd_m = os.fdopen(fd_m, "rb")
@ -65,7 +65,7 @@ def run_task_with_own_pty(task):
if status != 0:
print("task %s exited badly: %d" % (task.__name__, status))
exit(1)
sys.exit(1)
return 0