Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send all stderr and stdout to the output channel when a DVC process fails #3857

Merged
merged 3 commits into from
May 10, 2023

Conversation

mattseddon
Copy link
Member

@mattseddon mattseddon commented May 10, 2023

As discussed in the cross-team meeting this morning (cc @dberenbaum).

It is useful to send all of the stderr/stdout to the output channel when a DVC process fails. This PR makes the necessary updates.

Demo

Screen.Recording.2023-05-10.at.2.41.28.pm.mov

@mattseddon mattseddon added the product PR that affects product label May 10, 2023
@mattseddon mattseddon self-assigned this May 10, 2023
@@ -164,8 +164,8 @@ export class DvcRunner extends Disposable implements ICli {
{
...baseEvent,
duration: stopWatch.getElapsedTime(),
exitCode,
stderr
errorOutput: stderr,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[F] The runner and viewer show processes in the foreground so there is no change for these

@@ -180,8 +196,8 @@ export class Cli extends Disposable implements ICli {
{
...baseEvent,
duration,
exitCode: cliError.exitCode,
stderr: cliError.stderr
errorOutput: all || cliError.stderr,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[F] If we have captured a valid all string (length > 0) then we will use that, otherwise use the stderr from the generated error. I feel like this way there will always be something provided to the output channel

@mattseddon mattseddon marked this pull request as ready for review May 10, 2023 05:22
@mattseddon mattseddon requested review from sroy3 and julieg18 as code owners May 10, 2023 05:22
@mattseddon mattseddon requested a review from shcheklein May 10, 2023 05:22
backgroundProcess.all?.on(
'data',
chunk => (all += transformChunkToString(chunk))
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be moved to a private function, or even a util (just because it's being duplicated from line 83)? That would also make sure this line is covered since line 83 is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did have this in a separate helper function but the string was not captured as expected and passed to the catch block.

Copy link
Contributor

@julieg18 julieg18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

@dberenbaum
Copy link
Contributor

Thanks for taking this so quickly @mattseddon1

@mattseddon mattseddon enabled auto-merge (squash) May 10, 2023 22:08
@codeclimate
Copy link

codeclimate bot commented May 10, 2023

Code Climate has analyzed commit 3c8c9d1 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 91.6% (85% is the threshold).

This pull request will bring the total coverage in the repository to 94.9%.

View more on Code Climate.

@mattseddon mattseddon merged commit 8487032 into main May 10, 2023
@mattseddon mattseddon deleted the capture-all-std branch May 10, 2023 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product PR that affects product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants