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

just prints stderr to screen even if the command executes successfully #534

Open
kaiyoma opened this issue Apr 20, 2021 · 2 comments
Open

Comments

@kaiyoma
Copy link

kaiyoma commented Apr 20, 2021

typedoc has a known issue that it prints one byte (a single newline) to stderr even when successful (TypeStrong/typedoc#1566). If I run typedoc as part of my tasks with just, I can see that output:

[5:00:23 PM] ■ started 'build:types'
[5:00:30 PM] ■ finished 'build:types' in 6.77s
[5:00:30 PM] ■ started 'build:docs'

[5:00:39 PM] ■ finished 'build:docs' in 9.39s
[5:00:39 PM] ■ finished 'build' in 42.61s

I understand that just is probably printing stderr since something was written to it, which is reasonable. Unfortunately, several popular tools (Jest, typedoc, Storybook, etc) do this even when everything is successful. Maybe just should avoid printing stderr to the screen if the exit code of the task was 0?

@wbreza
Copy link

wbreza commented May 13, 2021

@kaiyoma Were you able to find any work around for this issue? I think I'm running into the same

@kaiyoma
Copy link
Author

kaiyoma commented May 13, 2021

@wbreza The issue specifically with typedoc has been fixed: TypeStrong/typedoc#1566

You can fix the Jest issue by using the standard reporter. I think Storybook still has the buggy behavior: storybookjs/storybook#14621

In general, I've added some custom code to our repo to run all our Just tasks like this:

try {
  execSync(task, { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'ignore'] });
} catch (error) {
  execSync(task, { encoding: 'utf-8' });
}

Basically, run the task while sending stderr to a black hole. If the task fails, run it again while preserving stderr, so that it bubbles up. Not ideal, since we have to run the task twice, but it works around the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants