visual studio - Gradle ExecTask and Windows start -


this question requires understanding of both window's start command's behavior , custom gradle exectask's handling of it.

question

why start, application parameter, wait application exit, when being executed within gradle exectask?

explanation

from command line, works expected (starts application , returns, without waiting application exit):

cmd /c mybuildenvironment.cmd && start "some title start" devenv.exe my.sln 

pretty simple, calls windows batch script setup environment , launches my.sln in visual studio. works fine, not waiting visual studio closed. and, gradle task meant achieve.

the same works "somewhat", using following gradle exectask start:

/**  * know executable + args replaced commandline.  they're  * there readability.  */ task openvssolution(type: exec, dependson: setupvssln) {     description 'opens vs solution, in appropriate version of visual studio.'      executable 'start'     environment = taskenv     workingdir '../../src/solution'     args = [vsdevenv, 'my.sln']     commandline wincmdprefix + executable + args } 

gradle happily reports build successful, while visual studio remains open.

however, "somewhat" because start ignore executable argument , open my.sln default application it, microsoft visual studio version selector. so, after research, found start assumes first parameter window title, application, , lastly, application arguments. so, tried this:

task openvssolution(type: exec, dependson: setupvssln) {     executable 'start'     environment = taskenv     workingdir '../../src/solution'     args = ['some title start', vsdevenv, 'my.sln']     commandline wincmdprefix + executable + args } 

everything works, start used correct version of visual studio's devenv.exe, varies based on vc platformtoolset, but...gradle sits in background waiting visual studio close.

why? how can achieve of desired behavior?

update

this might environmental problem. apparently, on 1 dev's machine, original gradle start task stay open, well. so, invocation of start through gradle waits complete, in environment. plot thickens...

gradle waiting start return guess, see post - run background job gradle. read comment after answer, started java if there equivalent of & (run in background) windows, wouldn't work.

you can try , wrapping in bat file, execute want in bat file in background return right away gradle happy.

hope helps.


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -