Skip to content

Commit

Permalink
CLIs: catch KeyboardInterrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr. Test committed Aug 30, 2024
1 parent 4724931 commit dae08c6
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ def main(argv):
verbose_check_call(PROJECT_SHELL_SCRIPT, *argv[1:])
except subprocess.CalledProcessError as err:
sys.exit(err.returncode)
except KeyboardInterrupt:
print('Bye!')
sys.exit(130)


if __name__ == '__main__':
Expand Down
3 changes: 3 additions & 0 deletions dev-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ def main(argv):
verbose_check_call(PROJECT_SHELL_SCRIPT, *argv[1:])
except subprocess.CalledProcessError as err:
sys.exit(err.returncode)
except KeyboardInterrupt:
print('Bye!')
sys.exit(130)


if __name__ == '__main__':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ def main(argv):
verbose_check_call(PROJECT_SHELL_SCRIPT, *argv[1:])
except subprocess.CalledProcessError as err:
sys.exit(err.returncode)
except KeyboardInterrupt:
print('Bye!')
sys.exit(130)


if __name__ == '__main__':
Expand Down
3 changes: 3 additions & 0 deletions generated_templates/piptools-python/your_cool_package/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ def main(argv):
verbose_check_call(PROJECT_SHELL_SCRIPT, *argv[1:])
except subprocess.CalledProcessError as err:
sys.exit(err.returncode)
except KeyboardInterrupt:
print('Bye!')
sys.exit(130)


if __name__ == '__main__':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ def main(argv):
verbose_check_call(PROJECT_SHELL_SCRIPT, *argv[1:])
except subprocess.CalledProcessError as err:
sys.exit(err.returncode)
except KeyboardInterrupt:
print('Bye!')
sys.exit(130)


if __name__ == '__main__':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ def main(argv):
verbose_check_call(PROJECT_SHELL_SCRIPT, *argv[1:])
except subprocess.CalledProcessError as err:
sys.exit(err.returncode)
except KeyboardInterrupt:
print('Bye!')
sys.exit(130)


if __name__ == '__main__':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ def main(argv):
verbose_check_call(PROJECT_SHELL_SCRIPT, *argv[1:])
except subprocess.CalledProcessError as err:
sys.exit(err.returncode)
except KeyboardInterrupt:
print('Bye!')
sys.exit(130)


if __name__ == '__main__':
Expand Down
3 changes: 3 additions & 0 deletions piptools-python/{{ cookiecutter.package_name }}/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ def main(argv):
verbose_check_call(PROJECT_SHELL_SCRIPT, *argv[1:])
except subprocess.CalledProcessError as err:
sys.exit(err.returncode)
except KeyboardInterrupt:
print('Bye!')
sys.exit(130)


if __name__ == '__main__':
Expand Down
3 changes: 3 additions & 0 deletions piptools-python/{{ cookiecutter.package_name }}/dev-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ def main(argv):
verbose_check_call(PROJECT_SHELL_SCRIPT, *argv[1:])
except subprocess.CalledProcessError as err:
sys.exit(err.returncode)
except KeyboardInterrupt:
print('Bye!')
sys.exit(130)


if __name__ == '__main__':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ def main(argv):
verbose_check_call(PROJECT_SHELL_SCRIPT, *argv[1:])
except subprocess.CalledProcessError as err:
sys.exit(err.returncode)
except KeyboardInterrupt:
print('Bye!')
sys.exit(130)


if __name__ == '__main__':
Expand Down

0 comments on commit dae08c6

Please sign in to comment.