Skip to content

Commit

Permalink
Avoid passing exception KeyboardInterrupt to the upper layer (ros2#788)
Browse files Browse the repository at this point in the history
* Avoid passing exception KeyboardInterrupt to the upper layer

Signed-off-by: Barry Xu <barry.xu@sony.com>
  • Loading branch information
Barry-Xu-2018 authored Jun 24, 2021
1 parent 6f7503e commit bb9c7ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion ros2bag/ros2bag/verb/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,11 @@ def main(self, *, args): # noqa: D102
record_options.include_hidden_topics = args.include_hidden_topics

recorder = Recorder()
recorder.record(storage_options, record_options)

try:
recorder.record(storage_options, record_options)
except KeyboardInterrupt:
pass

if os.path.isdir(uri) and not os.listdir(uri):
os.rmdir(uri)
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void stop_execution(const ProcessHandle & handle)
waitpid(handle, &child_return_code, 0);
// this call will make sure that the process does execute without issues before it is killed by
// the user in the test or, in case it runs until completion, that it has correctly executed.
EXPECT_THAT(WEXITSTATUS(child_return_code), Not(Eq(EXIT_FAILURE)));
EXPECT_THAT(WEXITSTATUS(child_return_code), EXIT_SUCCESS);
}

#endif // ROSBAG2_TEST_COMMON__PROCESS_EXECUTION_HELPERS_UNIX_HPP_

0 comments on commit bb9c7ae

Please sign in to comment.