fabiospampinato / vscode-terminals

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

Commands running twice #80

Open gustadsg opened 1 year ago

gustadsg commented 1 year ago

I configured terminals-manager to run some simple commands and it runs every command twice.

here are my workspace settings "settings": { "terminal.integrated.cwd": "path/to/project/root/folder", "terminals.autorun": true, "terminals.autokill": true, "terminals.terminals": [ { "name": "Startup", "focus": true, "cwd": "path/to/project/root/folder", "description": "Run startup commands", "commands": [ "git fetch --all --verbose", "${workbench.action.terminal.focus.next}", ] }, { "name": "VideoWall", "focus": false, "cwd": "path/to/project/subfolder", "description": "open VideoWall terminal on startup", "command": "git branch", }, { "name": "Desktop", "focus": false, "cwd": "path/to/project/root/folder", "description": "open Desktop terminal on startup", "command": "git branch", "split": "VideoWall" } ] },

As a result, git fetch runs twice, Desktop is focused instead of VideoWall and git branch runs 4 times (twice in each splitted terminal)

fabiospampinato commented 1 year ago

How are you running these terminals? And can you provide a simpler configuration with just 1 terminal that reproduces the problem?

usersina commented 11 months ago

I also had something similar happen with a repo/repo.code-workspace config file:

{
  "folders": [
    {
      "name": "user-service",
      "path": "user-service"
    },
    {
      "name": "product-service",
      "path": "product-service"
    }
  ],
  "settings": {
    "terminals.autokill": true,
    "terminals.autorun": true,
    "terminals.terminals": [
      {
        "name": "user-service",
        "cwd": "/Users/myuser/repo/user-service",
        "command": "docker-compose up", // this was running twice
        "dynamicTitle": true,
        "open": true
      },
      {
        "name": "product-service",
        "cwd": "/Users/myuser/repo/product-service",
        "command": "docker-compose up", // this was running twice as well
        "dynamicTitle": true,
        "open": true
      }
    ]
  }
}

The workaround I did is to create a .vscode/terminals.json file for each sub repository with the individual config, but that's not perfect since which one opens first is not guaranteed, hence creating a race condition between which command runs first.