[Bug] Issue with Code Runner Extension When Terminal is Already Running a Process
Subject: Issue with Code Runner Extension When Terminal is Already Running a Process
Description:
I am encountering an issue with the Code Runner extension in Visual Studio Code when I have a terminal open that is already running a process. When I open a different file and click on the "Run" button, the extension attempts to execute the command in the existing terminal, which is reserved for the previous process. Ideally, it should open a new instance or tab of the terminal to run the new command.
Steps to Reproduce:
- Open a terminal in VS Code.
- Start a long-running process or server in the terminal, so it remains active.
- Open a different file in VS Code.
- Click on the "Run" button for the code in the new file.
Expected Behavior:
I expected the Code Runner extension to open a new terminal instance or tab to run the command from the new file, even when a terminal with a running process is already open. This behavior would prevent conflicts with the existing terminal.
Actual Behavior:
The Code Runner extension attempts to execute the command in the existing terminal, which is already reserved for the previous process. This can cause confusion and conflicts.
Environment:
- Visual Studio Code Version: 1.82.2
- Code Runner Extension Version: [0.12.0]
- Operating System: [Debian 13 Linux]
demo video screen-record-bug.webm
Bhai koi solution mila????
Nope, I am not aware I stopped using Code Runner a long time ago.
Any alternative??
I have custom bash alias something like `run() { if [ "$1" = "-n" ]; then nodemon_mode=true shift else nodemon_mode=false fi
file="$1"
if [ -z "$file" ]; then
echo "Usage: run [-n] <file>"
return 1
fi
ext="${file##*.}"
case "$ext" in
py) runner="python" ;;
js) runner="node" ;;
ts) runner="ts-node" ;;
c)
out="${file%.*}"
gcc "$file" -o "$out" && runner="./$out"
;;
cpp)
out="${file%.*}"
g++ "$file" -o "$out" && runner="./$out"
;;
java)
javac "$file" && runner="java ${file%.*}"
;;
sh) runner="bash" ;;
rb) runner="ruby" ;;
go) runner="go run" ;;
php) runner="php" ;;
*)
echo "Unsupported file type: .$ext"
return 1
;;
esac
if [ "$nodemon_mode" = true ]; then
nodemon --exec "$runner" "$file" -q
else
$runner "$file"
fi
}`
I put this in my .bashrc and .zshrc file So if do run -n filename.py it will keep listening to changes and it will run the file on save