EthanSK / restore-terminals-vscode

A VSCode extension to restore/startup terminals with a custom configuration
https://marketplace.visualstudio.com/items?itemName=EthanSK.restore-terminals
MIT License
74 stars 34 forks source link

Paste/Run cmd as soon as terminal is open #47

Open adigourdi opened 1 year ago

adigourdi commented 1 year ago

Description

artificialDelayMilliseconds only delays terminal startup, and all commands are pasted at the same time

Setup

I have multiple .Net projects that I need to run for my local dev env

I should cd into each project and execute dotnet run on them to build and run each project

Expected Behavior

  1. First terminal shows up, and runs the command
  2. Wait for artificialDelayMilliseconds
  3. Start second terminal, and go on

Actual Behavior

  1. Terminals are open one by one after artificialDelayMilliseconds and kept empty
  2. All commands get pasted at once
  3. Build issues occur due to concurrency

Config

{
  "restoreTerminals.artificialDelayMilliseconds": 1000,
  "restoreTerminals.terminals": [
    { "splitTerminals": [{ "commands": [" cd ProjectA", "dotnet run"] }] },
    { "splitTerminals": [{ "commands": [" cd ProjectB", "dotnet run"] }] },
    { "splitTerminals": [{ "commands": [" cd ProjectC", "dotnet run"] }] },
    { "splitTerminals": [{ "commands": [" cd ProjectD", "dotnet run"] }] }
  ]
}
adigourdi commented 1 year ago

Update:

I edited my config to use sleep inside the terminal

{
  "restoreTerminals.artificialDelayMilliseconds": 36,
  "restoreTerminals.terminals": [
    { "splitTerminals": [{ "commands": [" cd ProjectA", " sleep 0", "dotnet run"] }] },
    { "splitTerminals": [{ "commands": [" cd ProjectB", " sleep 1", "dotnet run"] }] },
    { "splitTerminals": [{ "commands": [" cd ProjectC", " sleep 2", "dotnet run"] }] },
    { "splitTerminals": [{ "commands": [" cd ProjectD", " sleep 3", "dotnet run"] }] }
  ]
}