vscode: [MacOs][Bug][Terminal] `sed: illegal option -- r` before executing commands
Does this issue occur when all extensions are disabled?: Yes
- VS Code Version:
1.71.0-784b0177c56c607789f9638da7b6bf3230d47a8c - OS Version: macOS 10.15.7
System:
OS: macOS 10.15.7
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 192.07 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 14.20.0 - ~/.nvm/versions/node/v14.20.0/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 6.14.17 - ~/.nvm/versions/node/v14.20.0/bin/npm
Steps to Reproduce:
- Open the integrated terminal, then select the
Terminaltab. - open a new terminal using bash.
- The following message appears before executing every command:
sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
Example
$ echo 'hi'
sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]
hi
Itโs likely that this issue is caused by https://github.com/microsoft/vscode/commit/e55863c5c1fc4515bd99e9cd4fb415788000a8b1#diff-3d4a2862d6125445f81871e00c3b6d60fa24ef567bdf20c2a185f151a1f86129R125
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 32
- Comments: 32 (3 by maintainers)
Commits related to this issue
- Remove reliance on sed -r Fixes #159864 — committed to microsoft/vscode by Tyriar 2 years ago
- Remove reliance on sed -r Fixes #159864 — committed to microsoft/vscode by Tyriar 2 years ago
- Use history in bash shell integration for unresolved aliases Fixes #156385 — committed to microsoft/vscode by Tyriar 2 years ago
The solution is to edit the file
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.shon line125and use the-Eflag instead of-r(since both serve the same purpose - enable use of extended regular expressions - on linux). On Mac-ris not a valid option, hence the issue.(i.e.๐
__vsc_current_command="$(builtin history 1 | sed -E 's/ *[0-9]+ +//')"@mostafa-yasen a fix should come in v1.71.1 within the week
OK well done thank you
The problem is indeed the
sed -rin https://github.com/microsoft/vscode/blob/784b0177c56c607789f9638da7b6bf3230d47a8c/src/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh#L125I guess that the fix should be to use just
sedand Basic Regular Expressions. The command should be:s/ *[0-9][0-9]* *//(two spaces before the last*).I have v1.71.1 and nothing changed
I have error message on each type comamnd in bash
Still getting this problem on MacOS 10.14.6.
Any ETD for patch release?
Incredibly annoying. Itโs funny because this was a rare time where I decided out the blue to update to the latest version of VSCode.
I canโt reproduce it in 1.71.2 ๐
Found solution, it helped me https://stackoverflow.com/a/73601736/3977725