Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I will answer my own question :

I use psutil instead of subprocess. There is the part of the code doing the job :

    process = psutil.Popen(["rosbag", "record", "-O",bag_filename]+topic_list)
    process.wait()
  except KeyboardInterrupt:
    process_util = psutil.Process(process.pid)
    children = process_util.get_children()
    for child_process in children:
      child_process.send_signal(signal.SIGINT)
      child_process.wait()
    process_util.send_signal(signal.SIGINT)
    process_util.wait()