nushell icon indicating copy to clipboard operation
nushell copied to clipboard

Wrong command with sudo in pipe results in IO mess.

Open ssfdust opened this issue 3 years ago • 4 comments

Describe the bug If some command fails in a pipe command that starts with sudo, the standard IO will be a mess.

To Reproduce Steps to reproduce the behavior:

  1. sudo wrong_cmd | something wrong
  2. input something, you need to keep pressing the keyboard
  3. press enter.

Expected behavior the sudo won't be executed or the prompt won't show until sudo command ends.

Screenshots 2021-07-18_15-47

Configuration (please complete the following information):

Run version | pivot and paste the output to show OS, features, etc.

> version | pivot
────┬────────────────────┬────────────────────────────────────────────────────────
 #  │ Column0            │ Column1                                                
────┼────────────────────┼────────────────────────────────────────────────────────
  0 │ version            │ 0.34.0                                                 
  1 │ branch             │ makepkg                                                
  2 │ short_commit       │ 181ee1da                                               
  3 │ commit_hash        │ 181ee1dade2aa9fbf7534e658bdd634260010867               
  4 │ commit_date        │ 2021-07-15 09:21:18                                    
  5 │ build_os           │ linux-x86_64                                           
  6 │ rust_version       │ rustc 1.55.0-nightly (952fdf2a1 2021-07-05)            
  7 │ cargo_version      │ cargo 1.55.0-nightly (3ebb5f15a 2021-07-02)            
  8 │ pkg_version        │ 0.34.0                                                 
  9 │ build_time         │ 2021-07-15 14:38:43                                    
 10 │ build_rust_channel │ release                                                
 11 │ features           │ ctrlc, dataframe, default, rustyline, term, which, zip 
 12 │ installed_plugins  │                                                        
────┴────────────────────┴────────────────────────────────────────────────────────

ssfdust avatar Jul 18 '21 08:07 ssfdust

This sounds like Nushell is having trouble with interactive, "prompt-style" commands.

I also noticed, when Nushell is launched from Bash (i.e., not a default shell), exiting back to Bash locks the bash input -- you type but it's not shown, however, it still gets passed to Bash. I tested with su | foo bar, then exiting to Bash.

kubouch avatar Jul 18 '21 16:07 kubouch

This issue is being marked stale because it has been open for 90 days without activity. If you feel that this is in error, please comment below and we will keep it marked as active. Otherwise, it will be closed in 10 days.

github-actions[bot] avatar Oct 17 '21 01:10 github-actions[bot]

I cannot reproduce the original issue (maybe because I have the password prompt disabled with sudo) but the su | foo bar issue is still present.

kubouch avatar Oct 22 '21 07:10 kubouch

I'm noticing an issue that I think is similar to this one. Essentially it looks like it boils down to exactly the quote below.

This sounds like Nushell is having trouble with interactive, "prompt-style" commands.

I also noticed, when Nushell is launched from Bash (i.e., not a default shell), exiting back to Bash locks the bash input -- you type but it's not shown, however, it still gets passed to Bash. I tested with su | foo bar, then exiting to Bash.

image

This is on the latest release 0.75.0.

alesito85 avatar Feb 16 '23 20:02 alesito85

I can't repro either.

Closing, but please reopen if you're able to repro with the latest nushell.

sophiajt avatar Aug 09 '23 18:08 sophiajt