Skip to content

Commit

Permalink
[jsk_rosbag_tools] logerr subprocess command if failed
Browse files Browse the repository at this point in the history
  • Loading branch information
iory committed Jun 28, 2022
1 parent 6d055a9 commit aeb95ea
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion jsk_rosbag_tools/tests/test_bag_to_video.py
Expand Up @@ -17,12 +17,16 @@ class TestBagToVideo(unittest.TestCase):
def _check_command(self, cmd):
proc = subprocess.Popen(cmd, shell=True,
stdout=subprocess.PIPE)

lines = ''
with proc.stdout:
for line in iter(proc.stdout.readline, b''):
rospy.loginfo('{}'.format(line.decode('utf-8').strip()))
lines += line.decode('utf-8').strip()
returncode = proc.wait()

if returncode != 0:
rospy.logerr('{}'.format(lines))
rospy.logerr('command {} failed.'.format(cmd))
raise RuntimeError('command {} failed.'.format(cmd))

def test_bag_to_video_and_video_to_bag_and_compress(self):
Expand Down

0 comments on commit aeb95ea

Please sign in to comment.