Skip to content

Commit

Permalink
Merge pull request #140 from jedie/dev
Browse files Browse the repository at this point in the history
CLIs: catch KeyboardInterrupt
  • Loading branch information
jedie authored Aug 30, 2024
2 parents c6c2f0a + dae08c6 commit 9318534
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 9318534

Please sign in to comment.