Page MenuHomePhabricator

[tbs.cli] Do not raise an error when an external subcommand fails
Closed, ResolvedPublic1 Estimated Story Points

Description

toolforge_cli.cli._run_external_command() raises an error when the subcommand it runs exits with a code other than 0. We are not currently handling the error and just letting the program crash.

The most straightforward way of handling this is probably to let the wrapped command forward whatever it would have output to stdout/err if run natively.

Related Objects

StatusSubtypeAssignedTask
ResolvedLucasWerkmeister
Resolvedmatmarex
ResolvedLegoktm
ResolvedLegoktm
Opendcaro
Resolveddcaro
ResolvedRaymond_Ndibe
Resolveddcaro
Resolveddcaro
Resolveddcaro
ResolvedRaymond_Ndibe
ResolvedSlst2020
ResolvedSlst2020
ResolvedSlst2020
ResolvedSlst2020

Event Timeline

The most straightforward way of handling this is probably to let the wrapped command forward whatever it would have output to stdout/err if run natively.

What do you mean by "run natively"?

Now that we have the verbose flag we can be more silent about it yep :)
We should make sure though that the return code is the same as the one for the subcommand though.

The most straightforward way of handling this is probably to let the wrapped command forward whatever it would have output to stdout/err if run natively.

What do you mean by "run natively"?

"directly" is probably a better word, i.e. it should produce the same output as if it were run without the toolforge cli wrapper.

Now that we have the verbose flag we can be more silent about it yep :)
We should make sure though that the return code is the same as the one for the subcommand though.

_run_external_command's return type is None. The only thing we use the return code for right now is to raise an error inside this command.

_run_external_command's return type is None. The only thing we use the return code for right now is to raise an error inside this command.

We should fix that too then :)

Slst2020 set the point value for this task to 1.Nov 23 2022, 4:42 PM

Change 860892 had a related patch set uploaded (by Slavina Stefanova; author: Slavina Stefanova):

[cloud/toolforge/toolforge-cli@main] cli: Do not crash on external subcommand failure

https://gerrit.wikimedia.org/r/860892

Change 860892 merged by jenkins-bot:

[cloud/toolforge/toolforge-cli@main] cli: Do not crash on external subcommand failure

https://gerrit.wikimedia.org/r/860892