1. subprocess.Popen 的打开与关闭
1.1 运行roslaunch
shell_roslaunch = subprocess.Popen(‘roslaunch xxx x.launch’, close_fds=True, preexec_fn=0s.setsid, shell=True)
1.2 关闭roslaunch
使用kill()
或者close()
并不能将终端的子进程关闭,需要使用如下指令:
os.killpg(self.bulldog_driver_keyboard.pid, signal.SIGTERM)