5

I am using the terminal in VS code on a Mac to run Python code, and with every command I return whether it results in an error or not, I get the following before my output:

sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]

I have no idea how this began showing up and no idea how to get rid of it.

Can someone please help point me in the right direction of removing this from my output?

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
user2813606
  • 797
  • 2
  • 13
  • 37

1 Answers1

2

Found on GitHub, worked flawlessly for me. I didn't even have the -r flag, so I just added -E after sed.

The solution is to edit the file /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh on line 125 and use the -E flag instead of -r (since both serve the same purpose - enable use of extended regular expressions - on linux). On Mac -r is not a valid option, hence the issue.

(i.e.:)

__vsc_current_command="$(builtin history 1 | sed -E 's/ *[0-9]+ +//')"