Monday, 8 May 2017

Start process and leave

Can we achieve this: start nodejs/phantomjs script from java rest api. I have tried below code

rt = Runtime.getRuntime();                                                    
p = rt.exec("node /extra/POC/index.js 14");
p.waitFor();

It is able to start but my java process is keep running until my script execution completes as using p.waitFor(); my script internally has conditions to do process.exit(); and i don't want java to wait till this script execution completed. java should just invoke the script and leave it and let index.js script will take care of remaining job. Can you provide some suggestions for this.



via snofty

No comments:

Post a Comment