Skip to content

Commit a98a8bd

Browse files
committed
Daemonize with nohup then wait
1 parent eb78860 commit a98a8bd

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Test daemonized worker with cancel
2+
on:
3+
- workflow_dispatch
4+
jobs:
5+
daemonize-test:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v3
9+
- name: daemonize but wait for cancel
10+
run: |
11+
# Run the signal-ignoring utility script as a detached
12+
# daemonized process, trying to disown it completely.
13+
# But retain control and wait for it to return, so it's
14+
# running in a separate session-id but it's
15+
# going to block until a cancel is sent. Block SIGINT with
16+
# nohup, so the setsid binary won't exit on the initial cancel
17+
# request signal.
18+
nohup setsid --fork --wait python3 ./signaller.py SIGINT 0<&- >&/dev/null
19+
- if: always()
20+
run: |
21+
cat signaller.pid
22+
ps -f -p "$(cat signaller.pid)"
23+
cat signaller.log
24+
ps -efH

0 commit comments

Comments
 (0)