nushell / nushell

A new type of shell
https://www.nushell.sh/
MIT License
32.07k stars 1.65k forks source link

History suggestion and autocompletion broken after chezmoi prompts #8344

Open fleetingbytes opened 1 year ago

fleetingbytes commented 1 year ago

Describe the bug

I use chezmoi to manage my dotfiles. Chezmoi sometimes has these interactive prompts about skipping or overwriting files when syncing my dotfiles. They work well in both PowerShell and Nushell

autocompletion_after_chezmoi_prompts_in_powershell As you can see, after the chezmoi update process finishes, I can still use the autocomplete feature of PowerShell.

In Nushell, autocompletion and accepting suggestions from the command history work well, as you can see at the beginning of this other animation. But after the chezmoi update procedure with the interactive prompts, the attempt to autocomplete or accept a suggestion from the Nushell command history completely scrambles the prompt, look:

autocompletion_after_chezmoi_prompts_in_nushell

Once it is scrambled like that I cannot even exit Nushell. I have to kill the terminal window. (This happens with Nushell running in the ConEmu64 Terminal, Nushell in Alacritty, and also in the native PowerShell.exe window, so I think that this is a Nushell issue)

How to reproduce

  1. run a chezmoi command which has interactive prompts
  2. then type something which triggers a suggestion from Nushell history or try to autocomplete something

Expected behavior

autocompletion and suggestions from command history work as expected after the interactive chezmoi prompt.

Screenshots

see the embedded gifs

Configuration

key value
version 0.76.0
branch
commit_hash
build_os windows-x86_64
build_target x86_64-pc-windows-msvc
rust_version rustc 1.69.0-nightly (44cfafe2f 2023-03-03)
rust_channel nightly-x86_64-pc-windows-msvc
cargo_version cargo 1.69.0-nightly (9880b408a 2023-02-28)
pkg_version 0.76.0
build_time 2023-03-06 13:38:57 +01:00
build_rust_channel release
features database, default, trash, which, zip
installed_plugins

Additional context

No response

fdncred commented 1 year ago

To me, this looks something like the crossterm raw state isn't getting turned off. That may be happening in reedline or nushell... I think. I'm not sure how to solve it though. Someone probably needs to dig into the completions and maybe the completion menus to see if something weird is going on.

fleetingbytes commented 1 year ago

Here is a trace level log of how the suggestions and autocompletions first work, then chezmoi update runs, and then the error is there.

file.zip

here is an excerpt which I think is around where the error happened, I suspect it has something to do with this failed to get console mode for stdout: The handle is invalid. in lines 8120 and 8121 of the full log.

2023-03-07 02:37:27.927 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:1199] parsing: external call
2023-03-07 02:37:27.927 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:262] parse external
Already up to date.
failed to get console mode for stdout: The handle is invalid.
[?25l.local/opt/Conemu/ConEmu.xml has changed since chezmoi last wrote it? diff/overwrite/all-overwrite/skip/quit.local/opt/Conemu/ConEmu.xml has changed since chezmoi last wrote it? diff/overwrite/all-overwrite/skip/quit.local/opt/Conemu/ConEmu.xml has changed since chezmoi last wrote it? diff/overwrite/all-overwrite/skip/quit.local/opt/Conemu/ConEmu.xml has changed since chezmoi last wrote it? diff/overwrite/all-overwrite/skip/quit.local/opt/Conemu/ConEmu.xml has changed since chezmoi last wrote it? diff/overwrite/all-overwrite/skip/quit.local/opt/Conemu/ConEmu.xml has changed since chezmoi last wrote it? diff/overwrite/all-overwrite/skip/quit.local/opt/Conemu/ConEmu.xml has changed since chezmoi last wrote it? diff/overwrite/all-overwrite/skip/quit.local/opt/Conemu/ConEmu.xml has changed since chezmoi last wrote it? diff/overwrite/all-overwrite/skip/quit.local/opt/Conemu/ConEmu.xml has changed since chezmoi last wrote it? diff/overwrite/all-overwrite/skip/quit.local/opt/Conemu/ConEmu.xml has changed since chezmoi last wrote it? diff/overwrite/all-overwrite/skip/quit.local/opt/Conemu/ConEmu.xml has changed since chezmoi last wrote it? diff/overwrite/all-overwrite/skip/quit.local/opt/Conemu/ConEmu.xml has changed since chezmoi last wrote it? diff/overwrite/all-overwrite/skip/quit.local/opt/Conemu/ConEmu.xml has changed since chezmoi last wrote it? diff/overwrite/all-overwrite/skip/quit.local/opt/Conemu/ConEmu.xml has changed since chezmoi last wrote it? s [?1002l[?1003l[?25hfailed to get console mode for stdout: The handle is invalid.
[?25l.local/opt/Conemu/ConEmu/clink/profile/.history has changed since chezmoi last wrote it? diff/overwrite/all-overwrite/skip/quit.local/opt/Conemu/ConEmu/clink/profile/.history has changed since chezmoi last wrote it? diff/overwrite/all-overwrite/skip/quit.local/opt/Conemu/ConEmu/clink/profile/.history has changed since chezmoi last wrote it? diff/overwrite/all-overwrite/skip/quit.local/opt/Conemu/ConEmu/clink/profile/.history has changed since chezmoi last wrote it? diff/overwrite/all-overwrite/skip/quit.local/opt/Conemu/ConEmu/clink/profile/.history has changed since chezmoi last wrote it? s [?1002l[?1003l[?25hThis is the default configuration for your IAV laptop.
2023-03-07 02:37:40.592 PM [INFO ] nu_utils::utils: perf: C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\util.rs:298:9 eval_source entry #1 took 12.6653492s
]133;D;0\]7;file://20IAV016996N-0/C:\Users\ssiegmun\]2;~[?1l2023-03-07 02:37:40.592 PM [INFO ] nu_utils::utils: perf: C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\repl.rs:678:13 processing line editor input took 33.5502877s
2023-03-07 02:37:40.592 PM [INFO ] nu_utils::utils: perf: C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\repl.rs:687:13 finished repl loop took 33.5529041s
2023-03-07 02:37:40.592 PM [INFO ] nu_utils::utils: perf: C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\repl.rs:185:13 merge env took 6.3µs
2023-03-07 02:37:40.592 PM [INFO ] nu_utils::utils: perf: C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\repl.rs:199:13 reset ctrlc took 100ns
2023-03-07 02:37:40.592 PM [INFO ] nu_utils::utils: perf: C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\repl.rs:213:13 reset sig_quit took 100ns
2023-03-07 02:37:40.593 PM [INFO ] nu_utils::utils: perf: C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\repl.rs:237:13 get config/cursor config took 840.2µs
2023-03-07 02:37:40.593 PM [INFO ] nu_utils::utils: perf: C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\repl.rs:264:13 reedline builder took 128.1µs
2023-03-07 02:37:40.593 PM [INFO ] nu_utils::utils: perf: C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\repl.rs:285:13 reedline coloring/style_computer took 1.6µs
2023-03-07 02:37:40.593 PM [INFO ] nu_utils::utils: perf: C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\repl.rs:300:13 reedline menus took 229.6µs
2023-03-07 02:37:40.593 PM [INFO ] nu_utils::utils: perf: C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\repl.rs:330:13 reedline buffer_editor took 600ns
2023-03-07 02:37:40.594 PM [INFO ] nu_utils::utils: perf: C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\repl.rs:345:13 sync_history took 509.1µs
2023-03-07 02:37:40.594 PM [INFO ] nu_utils::utils: perf: C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\repl.rs:376:13 keybindings took 65.7µs
2023-03-07 02:37:40.594 PM [INFO ] nu_utils::utils: perf: C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\repl.rs:393:13 pre-prompt hook took 41.7µs
2023-03-07 02:37:40.594 PM [INFO ] nu_utils::utils: perf: C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\repl.rs:411:13 env-change hook took 1.7µs
2023-03-07 02:37:40.595 PM [TRACE] nu_cli::prompt_update: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\prompt_update.rs:42] get_prompt_string (block) C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\prompt_update.rs:45:21
2023-03-07 02:37:40.595 PM [TRACE] nu_cli::prompt_update: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\prompt_update.rs:42] get_prompt_string (block) C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\prompt_update.rs:45:21
2023-03-07 02:37:40.595 PM [TRACE] nu_cli::prompt_update: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\prompt_update.rs:42] get_prompt_string (block) C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\prompt_update.rs:45:21
2023-03-07 02:37:40.595 PM [TRACE] nu_cli::prompt_update: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\prompt_update.rs:42] get_prompt_string (block) C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\prompt_update.rs:45:21
2023-03-07 02:37:40.595 PM [TRACE] nu_cli::prompt_update: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\prompt_update.rs:42] get_prompt_string (block) C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\prompt_update.rs:45:21
2023-03-07 02:37:40.595 PM [TRACE] nu_cli::prompt_update: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\prompt_update.rs:42] get_prompt_string (block) C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\prompt_update.rs:45:21
2023-03-07 02:37:40.595 PM [TRACE] nu_cli::prompt_update: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\prompt_update.rs:144] update_prompt C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\prompt_update.rs:144:56
2023-03-07 02:37:40.595 PM [INFO ] nu_utils::utils: perf: C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\repl.rs:423:13 update_prompt took 925.1µs
2023-03-07 02:37:40.596 PM [TRACE] nu_cli::syntax_highlight: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\syntax_highlight.rs:18] highlighting: 
2023-03-07 02:37:40.596 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:5483] parsing block: LiteBlock { block: [] }
2023-03-07 02:37:43.210 PM [TRACE] nu_cli::syntax_highlight: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\syntax_highlight.rs:18] highlighting: c
2023-03-07 02:37:43.210 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:5483] parsing block: LiteBlock { block: [LitePipeline { commands: [Command(None, LiteCommand { comments: [], parts: [Span { start: 31999, end: 32000 }] })] }] }
2023-03-07 02:37:43.210 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:4958] parsing: expression
2023-03-07 02:37:43.210 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2334] parsing: filesize
2023-03-07 02:37:43.210 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2205] parsing: duration
2023-03-07 02:37:43.210 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2141] parsing: datetime
2023-03-07 02:37:43.210 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:1432] parsing: range
2023-03-07 02:37:43.210 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:1035] parsing: call
2023-03-07 02:37:43.210 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2334] parsing: filesize
2023-03-07 02:37:43.210 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2205] parsing: duration
2023-03-07 02:37:43.210 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2141] parsing: datetime
2023-03-07 02:37:43.210 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:1432] parsing: range
2023-03-07 02:37:43.210 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:1189] parsing: range [99] 
2023-03-07 02:37:43.210 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:1199] parsing: external call
2023-03-07 02:37:43.210 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:262] parse external
2023-03-07 02:37:43.330 PM [TRACE] nu_cli::syntax_highlight: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\syntax_highlight.rs:18] highlighting: ch
2023-03-07 02:37:43.330 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:5483] parsing block: LiteBlock { block: [LitePipeline { commands: [Command(None, LiteCommand { comments: [], parts: [Span { start: 31999, end: 32001 }] })] }] }
2023-03-07 02:37:43.330 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:4958] parsing: expression
2023-03-07 02:37:43.330 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2334] parsing: filesize
2023-03-07 02:37:43.330 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2205] parsing: duration
2023-03-07 02:37:43.330 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2141] parsing: datetime
2023-03-07 02:37:43.330 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:1432] parsing: range
2023-03-07 02:37:43.330 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:1035] parsing: call
2023-03-07 02:37:43.330 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2334] parsing: filesize
2023-03-07 02:37:43.330 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2205] parsing: duration
2023-03-07 02:37:43.330 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2141] parsing: datetime
2023-03-07 02:37:43.330 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:1432] parsing: range
2023-03-07 02:37:43.330 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:1189] parsing: range [99, 104] 
2023-03-07 02:37:43.330 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:1199] parsing: external call
2023-03-07 02:37:43.330 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:262] parse external
2023-03-07 02:37:43.396 PM [TRACE] nu_cli::syntax_highlight: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\syntax_highlight.rs:18] highlighting: che
2023-03-07 02:37:43.396 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:5483] parsing block: LiteBlock { block: [LitePipeline { commands: [Command(None, LiteCommand { comments: [], parts: [Span { start: 31999, end: 32002 }] })] }] }
2023-03-07 02:37:43.396 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:4958] parsing: expression
2023-03-07 02:37:43.396 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2334] parsing: filesize
2023-03-07 02:37:43.396 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2205] parsing: duration
2023-03-07 02:37:43.396 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2141] parsing: datetime
2023-03-07 02:37:43.396 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:1432] parsing: range
2023-03-07 02:37:43.396 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:1035] parsing: call
2023-03-07 02:37:43.396 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2334] parsing: filesize
2023-03-07 02:37:43.396 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2205] parsing: duration
2023-03-07 02:37:43.396 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:2141] parsing: datetime
2023-03-07 02:37:43.396 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:1432] parsing: range
2023-03-07 02:37:43.396 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:1189] parsing: range [99, 104, 101] 
2023-03-07 02:37:43.396 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:1199] parsing: external call
2023-03-07 02:37:43.396 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:262] parse external
2023-03-07 02:37:46.403 PM [TRACE] nu_cli::syntax_highlight: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-cli-0.76.0\src\syntax_highlight.rs:18] highlighting: che[C
2023-03-07 02:37:46.403 PM [TRACE] nu_parser::parser: [C:\Users\ssiegmun\.cargo\registry\src\github.com-1ecc6299db9ec823\nu-parser-0.76.0\src\parser.rs:5483] parsing block: LiteBlock { block: [LitePipeline { commands: [Command(None, LiteCommand { comments: [], parts: [Span { start: 31999, end: 32004 }] })] }] }
fdncred commented 1 year ago

I don't believe failed to get console mode for stdout: The handle is invalid. is coming from nushell

fleetingbytes commented 1 year ago

I don't believe failed to get console mode for stdout: The handle is invalid. is coming from nushell

Could it be that it's coming from chezmoi then? But in PowerShell this error does not happen. Maybe @twpayne from chezmoi can tell what's going on here.

twpayne commented 1 year ago

chezmoi uses termenv to facilitate its interactive terminal prompts. On Windows, you must make a Windows API call to enable virtual terminal processing on the console (see termenv.EnableVirtualTerminalProcessing, and especially its source code), and it is good practice to restore the terminal afterwards.

From reading this issue, it looks like nushell on Windows is not restoring the console state that nushell needs after running interactive programs.

fdncred commented 1 year ago

@Nagidal I didn't change much but I'd be interested to see if #8373 makes any difference in your scenario. Can you test it please and report back?

fleetingbytes commented 1 year ago

@Nagidal I didn't change much but I'd be interested to see if #8373 makes any difference in your scenario. Can you test it please and report back?

Alas, same error: failed to get console mode for stdout: The handle is invalid. on line 7652 of this new trace file nulog.log

key value
version 0.76.1
branch add_error_checking_to_vt
commit_hash 21943bdb9965e5ca67a3881e6ddcf5cd27793030
build_os windows-x86_64
build_target x86_64-pc-windows-msvc
rust_version rustc 1.66.1 (90743e729 2023-01-10)
rust_channel 1.66.1-x86_64-pc-windows-msvc
cargo_version cargo 1.66.1 (ad779e08b 2023-01-10)
build_time 2023-03-10 07:21:16 +01:00
build_rust_channel debug
features default, zip
installed_plugins