diff options
| author | RobinFrcd <29704178+RobinFrcd@users.noreply.github.com> | 2020-08-08 00:52:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-08 01:52:47 +0300 |
| commit | 3a0362a6028b949016cd2a67bbeeab9b8d8bf50c (patch) | |
| tree | 28be91f83e270b4ff461c39cef3047e68cd778bc /tests/fixtures/project_with_tasks_that_handle_sigterm | |
| parent | docs: add eugenetriguba as a contributor (#17) (diff) | |
| download | taskipy2-3a0362a6028b949016cd2a67bbeeab9b8d8bf50c.zip | |
Propagate SIGTERM to child processes (#19)
SIGTERM sent to taskipy are handed over to task subprocess
Diffstat (limited to 'tests/fixtures/project_with_tasks_that_handle_sigterm')
| -rw-r--r-- | tests/fixtures/project_with_tasks_that_handle_sigterm/loop_with_sigterm_handler.py | 18 | ||||
| -rw-r--r-- | tests/fixtures/project_with_tasks_that_handle_sigterm/pyproject.toml | 6 |
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/fixtures/project_with_tasks_that_handle_sigterm/loop_with_sigterm_handler.py b/tests/fixtures/project_with_tasks_that_handle_sigterm/loop_with_sigterm_handler.py new file mode 100644 index 0000000..508c17f --- /dev/null +++ b/tests/fixtures/project_with_tasks_that_handle_sigterm/loop_with_sigterm_handler.py @@ -0,0 +1,18 @@ +import signal +import sys +import time + + +def main(): + while True: + time.sleep(0.1) + + +def sigterm_handler(sig, frame): + print('Shutdown gracefully with sigterm...') + sys.exit(123) + + +if __name__ == '__main__': + signal.signal(signal.SIGTERM, sigterm_handler) + main() diff --git a/tests/fixtures/project_with_tasks_that_handle_sigterm/pyproject.toml b/tests/fixtures/project_with_tasks_that_handle_sigterm/pyproject.toml new file mode 100644 index 0000000..1790d9b --- /dev/null +++ b/tests/fixtures/project_with_tasks_that_handle_sigterm/pyproject.toml @@ -0,0 +1,6 @@ +[tool.poetry] +name = "taskipy" +description = "tasks runner for python projects" + +[tool.taskipy.tasks] +run_loop_with_sigterm_handling = "python3 loop_with_sigterm_handler.py" |