Skip to content

Commit

Permalink
fix: change the way the process is killed
Browse files Browse the repository at this point in the history
  • Loading branch information
atsushi421 authored Oct 19, 2023
1 parent 56e1bfd commit 8ab7da5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ros2caret/verb/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import os
import subprocess
import signal

from typing import Optional

Expand Down Expand Up @@ -222,12 +223,12 @@ def _fini():
node.stop_progress()
node.end()
if clock_recorder:
clock_recorder.terminate()
os.killpg(os.getpgid(clock_recorder.pid), signal.SIGTERM)

Check warning on line 226 in ros2caret/verb/record.py

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (killpg)

Check warning on line 226 in ros2caret/verb/record.py

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (getpgid)
print('stopping & destroying tracing session')
lttng.lttng_fini(session_name=args.session_name)

if args.record_clock:
clock_recorder = subprocess.Popen(['ros2', 'run', 'caret_trace', 'clock_recorder'])
clock_recorder = subprocess.Popen(['ros2', 'run', 'caret_trace', 'clock_recorder'], preexec_fn=os.setpgrp)

Check warning on line 231 in ros2caret/verb/record.py

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (preexec)

Check warning on line 231 in ros2caret/verb/record.py

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (setpgrp)
else:
clock_recorder = None
execute_and_handle_sigint(_run, _fini)
Expand Down

0 comments on commit 8ab7da5

Please sign in to comment.