-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VS Code will tell the terminal process terminated with an error code if the last command failed when exiting the terminal #33200
Comments
We print the exit code when it's non-zero and some shells seem to exit with a code of 1. I'm not sure why but it also happens on Mac but not for me with my setup on Ubuntu. @sylveon any ideas why your shell returns 1 when running |
It returns the exit code of the last command. For example, if I run (as non-root)
It's gonna say it terminated with code 2, which according to Retaking the If the last command succeeds, it's not complaining, since bash is gonna exit with code 0, for example this works fine
Here is my .bashrc, in case it might help: #
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# Huge prompt
PS1="\`LAST_COMMAND=\$?; " # Save last command return value for line 3 of PS1
PS1+="IFS=';' read -sdR -p $'\E[6n' ROW COL; if [ \${COL#*[} -ne 1 ]; then echo -n $'\n'; fi; " # Print a new line if the last command did not have one
PS1+="if [ \$LAST_COMMAND -eq 0 ]; then echo \[\e[1\;33m\]^_^; else echo \[\e[1\;31m\]O_O; fi\`" # Print a different smiley face depending on last command success
PS1+="\[\e[0m\][" # Reset colors and opening brace
PS1+="`if [ $EUID -eq 0 ]; then echo $'\e[31m'; fi`" # Print username red if running as root
PS1+="`getent passwd $LOGNAME | cut -d: -f5 | cut -d, -f1`" # Print pretty username
PS1+="\[\e[0m\]@" # Reset colors and at symbol
PS1+="`awk -F= '/PRETTY/ {gsub(/"/,"");print $2}' /etc/machine-info` " # Print pretty machine name
PS1+="\[\e[1;36m\]\w\[\e[0m\]]\\$ " # The rest of the fucking owl
# Aliases, features and environment variables
alias su='sudo su' # Make su work when root login is disabled
if [[ $EUID -ne 0 ]]; then alias pacman='pacaur'; fi # Pacaur won't run as root, so set alias only for non-root
alias ls='ls --color -A' # Colors and hidden files by default in ls
alias grep='grep --color' # Colors in grep
alias shutdown='sudo shutdown' # Handy alias
alias poweroff='sudo shutdown -h now' # ^
alias reboot='sudo shutdown -r now' # ^
shopt -s autocd # Automatically CD to a folder if we enter it directly to the prompt
source /usr/share/doc/pkgfile/command-not-found.bash # Show if a missing command can be found in a package
export PKGFILE_PROMPT_INSTALL_MISSING=1 # Prompt to install said package
export HASTE_SERVER=https://haste.charlesmilette.net # Custom server for hastebin uploader script
export PROMPT_DIRTRIM=4 # Trim directory in prompt if too long
shopt -s cdspell # Fix those fucking typos
shopt -s dirspell # ^
eval "$(thefuck --alias)" # FUCK
eval "$(hub alias -s)" |
WSL bash also behaves the same way. Likewise with cmd.exe on Windows. For example, typing the following in a cmd.exe terminal reproduces the error:
|
If exit does indeed make the shell return non-zero there isn't much we can do until we know what command is being run #20676 |
I also noticed this on both Windows 10 and Ubuntu. What I did was try to exit but I miss typed it but I get the error code 127 instead of 1 on both operating systems
|
I'm able to reproduce the use case by @josecrmrz above. That is,
The terminal closes and I get the banner at the top showing:
Code 1.18.1 |
Closing in favor of #40503 |
Steps to Reproduce:
Expected behavior:
Shell exits without any error.
Actual behavior:
Reproduces without extensions: Yes
The text was updated successfully, but these errors were encountered: