How to launch another shell script as a background process?

How to launch another shell script as a background process?

I am launching another shell script, which runs forever, but gradle keeps waiting for that process to be terminated, and eventually the gradle hangs and keeps waiting for that process to finish. How do I launch that shell script as a background process without making gradle wait for that process to finish?

Gradle’s ‘(Java)Exec’ task doesn’t support this, but you can use the normal Java means (e.g. ‘java.lang.ProcessBuilder’).

Thanks for replying… but can you give me an example? Does executor supports this kind of handling?

Thanks peter… but I got it… Thanks for the clue.

I should have mentioned that there is also Groovy’s ‘String.execute()’, where the string is the command line to execute. Like ‘ProcessBuilder’, it returns a ‘Process’ for further handling.

Yes… its there… but it hangs the entire build process… since my shell script is never ending process… I tried that one… before posting questionhere…

Groovy’s ‘String.execute()’ returns immediately, just like ‘ProcessBuilder.start()’ (I double-checked). You must have done something different.

All right… I will double check…