You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cannot define multiple commands in tasks.json #981
This is very important. Say I want a test command and a build command. The test command needs to run mocha and the build command babel or tsc for example. "command" should be allowed for individual tasks in the tasks array.
The workaround is nice, but it is not cross-platform and quotes have to be escaped.
For cross-platform you would have to define
Yes. But to be clear, I wouldn't want to replicate all the tasks for both. Basically, I want to be able to do N tasks per file as the original requestor suggested. For me, 9 of the 10 tasks I want can all be in one definition. One of them is different though and needs to do X for Windows and Y for OSX.
Dirk Bäumer (@dbaeumer) Your response raised good point to my suspicion: why my vscode was not auto updated or shown me a latest version is available ? Shall it be raised as a separate bug ? (case it's not known issue)
(BTW: Updating to latest version fixed the task.json issue, thanks on that).
Having different commands for different tasks is available since 1.9. I am closing the issue. If anyone sees problems with the support available since 1.9 please open a separate issue.
Dirk Bäumer (@dbaeumer) Hi! Since you closed this ticket (and also closed #7863 as a duplicate of this one), does that mean that vscode now supports concurrent execution of commands?
Dirk Bäumer (@dbaeumer) here is a idea (suggestion?) If I have 4 background tasks running, I don't really want to keep swapping the display for each task. I would like to be able to merge a few terminal outputs, and have a header (TASK 1: -> output string , etc. ) so that I can follow a few tasks at at a time and see what they are doing.
Activity
danielschmitz commentedon Dec 6, 2015
Let me suggest a simple example to implementation (tasks.json) ....
AND CTRL+SHIFT+B:
usagi commentedon Dec 6, 2015
Hi, I need the feature too 👍 But, priority is low. Because, we can multiple command with the trick: http://qiita.com/usagi/items/5a0f4edc99420173abb3 ( Sorry, its wrote in Japanese. )
The abstract of the trick are:
shorcmd.exeorpowershell.exeor any other common shell program.-c( withsh) or/c( withcmd.exe) or-Command( withpowershell.exe).\"quoted. ( eg. :"args" : "\"your-command arg1 arg2 arg3\"")Example
tasks.json:{ "version": "0.1.0" , "command": "sh" , "isShellCommand": true , "showOutput": "always" , "args": [ "-c" ] , "tasks": [ { "taskName": "la" , "suppressTaskName": true , "args": [ "\"ls -la\"" ] } , { "taskName": "hoge" , "suppressTaskName": true , "args": [ "\"echo hoge\"" ] } , { "taskName": "build" , "suppressTaskName": true , "args": [ "\"mkdir -k build; cd build; cmake ..; make\"" ] } , { "taskName": "debug" , "suppressTaskName": true , "args": [ "\"cd build; gdb bin/my-executable\"" ] } ] }Its can run in the current release version ( 0.10.3 ). 🐰
danielschmitz commentedon Dec 6, 2015
Nice USAGI/USAGI.NETWORK (@usagi) , this is my solution:
tip: cmd for windows, sh for linux
shortcut: (override default build command)
when i hit ctrl+shift+b, subtasks show up:
Bonus:
you can define your own shortcut:
felixfbecker commentedon Dec 8, 2015
This is very important. Say I want a test command and a build command. The test command needs to run
mochaand the build commandbabelortscfor example."command"should be allowed for individual tasks in the tasks array.The workaround is nice, but it is not cross-platform and quotes have to be escaped.
For cross-platform you would have to define
{ "linux": { "command": "sh", "args": ["-c"] }, "osx": { "command": "sh", "args": ["-c"] }, "windows": { "command": "powershell", "args": ["-Command"] } }and then duplicate the tasks property for every single OS :/
usagi commentedon Dec 8, 2015
Felix Becker (@felixfbecker) It's nice follow-up 👍 We can use
"windows","linux", and"osx"for cross-platform portability.cfjedimaster commentedon Dec 17, 2015
Another plus one - and in my case, I can't use the workaround since I need a per OS switch and I can't rely on sh or cmd.
felixfbecker commentedon Dec 17, 2015
Raymond Camden (@cfjedimaster) Why can't you use the workaround exactly?
cfjedimaster commentedon Dec 17, 2015
Because my top level command would be start on Windows and open on OSX. So I can't use just cmd or just start and pass different args.
felixfbecker commentedon Dec 17, 2015
Raymond Camden (@cfjedimaster) You mean like this?
{ "version": "0.1.0", "isShellCommand": true, "osx": { "command": "sh", "args": ["-c"], "tasks": [ {"name": "run", "args": ["open mysuperawesomefile.txt"]} ] }, "windows": { "command": "cmd", "args": ["/C"], "tasks": [ {"name": "run", "args": ["start mysuperawesomefile.txt"]} ] } }cfjedimaster commentedon Dec 17, 2015
Yes. But to be clear, I wouldn't want to replicate all the tasks for both. Basically, I want to be able to do N tasks per file as the original requestor suggested. For me, 9 of the 10 tasks I want can all be in one definition. One of them is different though and needs to do X for Windows and Y for OSX.
81 remaining items
guardrex commentedon Mar 10, 2017
Vishal (@foo-baar) Old version of VSC? What's it say for the version under Help > About? Current version should be 1.10.2.
dbaeumer commentedon Mar 10, 2017
Commands per task work even in the old runner, but require 1.9
foo-baar commentedon Mar 10, 2017
Dirk Bäumer (@dbaeumer) Your response raised good point to my suspicion: why my vscode was not auto updated or shown me a latest version is available ? Shall it be raised as a separate bug ? (case it's not known issue)
(BTW: Updating to latest version fixed the task.json issue, thanks on that).
dbaeumer commentedon Mar 13, 2017
Vishal (@foo-baar) yes, please open a separate issue for that. VS Code should inform you about updates.
foo-baar commentedon Mar 13, 2017
Done Dirk Bäumer (@dbaeumer), Danke
dbaeumer commentedon Apr 26, 2017
Having different commands for different tasks is available since 1.9. I am closing the issue. If anyone sees problems with the support available since 1.9 please open a separate issue.
radix commentedon May 5, 2017
Dirk Bäumer (@dbaeumer) Hi! Since you closed this ticket (and also closed #7863 as a duplicate of this one), does that mean that vscode now supports concurrent execution of commands?
dbaeumer commentedon May 8, 2017
It does with the new terminal runner you need to opt in using
"version": "2.0.0"DrYSG commentedon May 8, 2017
Dirk Bäumer (@dbaeumer) Hey, this is great. Can you advertize this to the world! See my Stack Overflow question:
https://stackoverflow.com/questions/43809502/getting-babel-to-watch-two-folders
dbaeumer commentedon May 9, 2017
Dr. YSG (@DrYSG) we will. We are currently working on making the terminal runner the default and writing corresponding documentation.
DrYSG commentedon May 9, 2017
Dirk Bäumer (@dbaeumer) here is a idea (suggestion?) If I have 4 background tasks running, I don't really want to keep swapping the display for each task. I would like to be able to merge a few terminal outputs, and have a header (TASK 1: -> output string , etc. ) so that I can follow a few tasks at at a time and see what they are doing.
vilicvane commentedon Jun 12, 2017
Dr. YSG (@DrYSG) you may want to check out my https://github.com/vilic/biu. (Sadly not well-documented)