Skip to content

avoid freeze when capturing external stderr - #6700

Merged
fdncred merged 4 commits into
nushell:mainfrom
WindSoilder:extern_stderr_capture
Oct 12, 2022
Merged

fdncred merged 4 commits into
nushell:mainfrom
WindSoilder:extern_stderr_capture

Conversation

@WindSoilder

@WindSoilder WindSoilder commented Oct 11, 2022 •

Copy link
Copy Markdown
Contributor

Description

Fix #5156
Relative #6219 and #5625 (I can't reproduce these relative issue, but I think this pr can resolve them)

The main issue is that when #4986 is landed, nushell doesn't handle external message properly.

In general, the thread which sends external result is sending stderr message, stdout message, exit code in order. So the external result receiver must make sure that it receives relative message in the same order. Or we'll likely to get a dead lock.

About the test

I've done manually test which mentioned in #5625 (comment), to make automation test code simpler, I use the following script to simulate the behavior:

# test.sh
x=$(printf '=%.0s' {1..40960})
echo $x
echo $x 1>&2

command:

do -i {bash test.sh} | complete

Tests

Make sure you've done the following:

  • Add tests that cover your changes, either in the command examples, the crate/tests folder, or in the /tests folder.
  • Try to think about corner cases and various ways how your changes could break. Cover them with tests.
  • If adding tests is not possible, please document in the PR body a minimal example with steps on how to reproduce so one can verify your change works.

Make sure you've run and fixed any issues with these commands:

  • cargo fmt --all -- --check to check standard code formatting (cargo fmt --all applies these changes)
  • cargo clippy --workspace --features=extra -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect to check that you're using the standard code style
  • cargo test --workspace --features=extra to check that all the tests pass

@sholderbach

Copy link
Copy Markdown
Member

Wow that is subtle. Thanks for debugging that!

@fdncred

fdncred commented Oct 12, 2022

Copy link
Copy Markdown
Contributor

let's move forward with this, we still have a few days to test.

@fdncred
fdncred merged commit 5815f12 into nushell:main Oct 12, 2022
@WindSoilder
WindSoilder deleted the extern_stderr_capture branch October 12, 2022 13:45
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

Successfully merging this pull request may close these issues.

Capturing stderr hangs Nushell

3 participants