Skip to content

Fix panic when encountering ENOTTY. - #7001

Merged
sophiajt merged 1 commit into
nushell:mainfrom
IanManske:fix-enotty-panic
Nov 4, 2022
Merged

sophiajt merged 1 commit into
nushell:mainfrom
IanManske:fix-enotty-panic

Conversation

@IanManske

Copy link
Copy Markdown
Member

Description

This fix is related to #6788. It removes the .expect on the owner_pgid such that it is possible to reach the existing Err(Errno::ENOTTY) match case.
This allows nu to be run without a 'controlling terminal' (e.g., running a nu script from a window manager keybinding) like it was able to be before.

With this pr, debugging from vscode as described in #6788 no longer panics with tcgetpgrp: ENOTTY, but rather with ERROR: no TTY for interactive shell because interactive is true. I'm probably missing a flag or setting to make interactive false?

Tests + Formatting

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 tests pass

@sholderbach

Copy link
Copy Markdown
Member

I also encountered that our ForegroundProcess machinery will fail in case we can't do tcgetpgrp, after ignoring that in my VS Code experiments

@IanManske

Copy link
Copy Markdown
Member Author

I'm not sure this fixes the entire vscode issue, but it still fixes ENOTTY in general. So, I'll mark this as ready for review. Let me know if anything needs changing.

@IanManske
IanManske marked this pull request as ready for review November 4, 2022 18:06
@sophiajt
sophiajt merged commit f1bde69 into nushell:main Nov 4, 2022
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.

3 participants