[5/7] Eliminate catch(...) in pipe_command
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Test passed
|
Commit Message
Remove duplicate code in pipe_command using SCOPE_EXIT.
Tested on aarch64-linux.
---
gdb/cli/cli-cmds.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
Comments
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> Remove duplicate code in pipe_command using SCOPE_EXIT.
Tom> Tested on aarch64-linux.
Ok.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
@@ -1142,19 +1142,14 @@ pipe_command (const char *arg, int from_tty)
if (to_shell_command == nullptr)
error (_("Error launching \"%s\""), shell_command);
- try
- {
- stdio_file pipe_file (to_shell_command);
+ int exit_status;
+ {
+ SCOPE_EXIT { exit_status = pclose (to_shell_command); };
- execute_command_to_ui_file (&pipe_file, gdb_cmd.c_str (), from_tty);
- }
- catch (...)
- {
- pclose (to_shell_command);
- throw;
- }
+ stdio_file pipe_file (to_shell_command);
- int exit_status = pclose (to_shell_command);
+ execute_command_to_ui_file (&pipe_file, gdb_cmd.c_str (), from_tty);
+ }
if (exit_status < 0)
error (_("shell command \"%s\" failed: %s"), shell_command,