fabiospampinato / vscode-terminals

An extension for setting-up multiple terminals at once, or just running some commands.
MIT License
121 stars 19 forks source link

For a persistent terminal, already running, do not execute the command again #20

Open florentsolt opened 5 years ago

florentsolt commented 5 years ago

When a persistent terminal is already running, do not re-execute the command. As seen here https://github.com/fabiospampinato/vscode-terminals/blob/master/resources/persistent.gif when you re-open the terminal, the "while...." command is re send to the terminal. It should not be done IMHO.

fabiospampinato commented 5 years ago

I agree, but I don't think we can currently detect if the terminal is busy executing the command in question or not.

florentsolt commented 5 years ago

You can get from tmux (reading the content of the dir where it stores the sockets) and screen (via screen -ls) the list of active sessions (regarding the names you have in the conf) and assume they are running. Wort case scenario, the command is not running anymore, but should be in the shell history inside the screen/tmux.

fabiospampinato commented 5 years ago

@florentsolt I'm not sure that's a good enough solution 🤔

ctf0 commented 4 years ago

am also having the same issue but with long lived commands like npm watch, the temp solution is to make sure the command have "recycle": false this way it will create a new terminal every time u run it and you wont get an un-expected rerun of the same command when u kill it, ex.

vintprox commented 4 years ago

Hm, how do I exactly put screen -ls check in my commands sequence to deny others to run when it returns existing session? Thank you in advance!