@@ -110,7 +110,7 @@ trait RunModule extends WithJvmWorkerModule with RunModuleApi {
110110 /**
111111 * Runs this module's code in a subprocess and waits for it to finish
112112 */
113- def run (args : Task [Args ] = Task .Anon (Args ())): Task .Command [Unit ] = Task .Command {
113+ def run (args : Task [Args ] = Task .Anon (Args ())): Task .Command [Unit ] = Task .Command (exclusive = true ) {
114114 runForkedTask(finalMainClass, args)()
115115 }
116116
@@ -120,7 +120,7 @@ trait RunModule extends WithJvmWorkerModule with RunModuleApi {
120120 * since the code can dirty the parent Mill process and potentially leave it
121121 * in a bad state.
122122 */
123- def runLocal (args : Task [Args ] = Task .Anon (Args ())): Task .Command [Unit ] = Task .Command {
123+ def runLocal (args : Task [Args ] = Task .Anon (Args ())): Task .Command [Unit ] = Task .Command (exclusive = true ) {
124124 runLocalTask(finalMainClass, args)()
125125 }
126126
@@ -129,7 +129,7 @@ trait RunModule extends WithJvmWorkerModule with RunModuleApi {
129129 */
130130 def runMain (@ arg(positional = true ) mainClass : String , args : String * ): Task .Command [Unit ] = {
131131 val task = runForkedTask(Task .Anon { mainClass }, Task .Anon { Args (args) })
132- Task .Command { task() }
132+ Task .Command (exclusive = true ) { task() }
133133 }
134134
135135 /**
@@ -148,7 +148,7 @@ trait RunModule extends WithJvmWorkerModule with RunModuleApi {
148148 */
149149 def runMainLocal (@ arg(positional = true ) mainClass : String , args : String * ): Task .Command [Unit ] = {
150150 val task = runLocalTask(Task .Anon { mainClass }, Task .Anon { Args (args) })
151- Task .Command { task() }
151+ Task .Command (exclusive = true ) { task() }
152152 }
153153
154154 /**
0 commit comments