vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Rerunning `ls` appends `--color=auto` to executed command

Open joyceerhl opened this issue 3 years ago • 7 comments

Testing #156001

In Remote-WSL + bash + subshell, if I run ls and then use the command decoration to rerun the command, it instead runs ls --color=auto.

image

joyceerhl avatar Jul 26 '22 23:07 joyceerhl

This is also the reason git may be replaced by hub; we're sending the alias resolved command line instead of the raw command line as input.

Tyriar avatar Aug 08 '22 13:08 Tyriar

We should also verify this doesn't happen with aliases in zsh

Tyriar avatar Aug 09 '22 16:08 Tyriar

fyi verifier, reproduces in normal bash in a non-subshell

meganrogge avatar Aug 09 '22 16:08 meganrogge

to reproduce:

  1. run alias in a bash terminal to see the ones you've defined
  2. run the part to the left of =
  3. via the command decoration menu, rerun command
  4. 🐛 the command's alias (part to the right of =) is the input

meganrogge avatar Aug 09 '22 16:08 meganrogge

We should also verify this doesn't happen with aliases in zsh

it does not

meganrogge avatar Aug 09 '22 17:08 meganrogge

the alias value is also displayed in the run recent command quickpick atm

meganrogge avatar Aug 09 '22 17:08 meganrogge

I thought of an even better idea to what we talked about, we could use the old history method to supplement our current better method; if there are no problematic histcontrol settings and the latest history command changed between precious and now, assume it was an alias and use that?

Tyriar avatar Aug 10 '22 10:08 Tyriar

@joyceerhl could you verify this one when you get a chance?

Tyriar avatar Aug 22 '22 22:08 Tyriar

🤔 still seems to repro in Remote-WSL image

Version: 1.71.0-insider (user setup) Commit: e3043ebbc6f73fe66beb80ce6312818ae0e66798 Date: 2022-08-23T10:56:12.685Z Electron: 19.0.12 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Windows_NT x64 10.0.22000 Sandboxed: Yes

joyceerhl avatar Aug 23 '22 15:08 joyceerhl

Does echo $HISTCONTROL show anything? My Ubuntu wsl shows ignoreboth in which case we cannot use that history method which is a known edge case that I don't think we can handle currently and is not worth tracking imo.

Tyriar avatar Aug 23 '22 16:08 Tyriar

Yeah the output is ignoreboth. Is there a value I can change that to which would allow me to verify the fix?

joyceerhl avatar Aug 23 '22 16:08 joyceerhl

@joyceerhl it can be set to the empty string or ignorespace - set this in your ~/.bashrc which should run before shell integration

Tyriar avatar Aug 23 '22 16:08 Tyriar

image

joyceerhl avatar Aug 23 '22 16:08 joyceerhl