scholarsmate commented on code in PR #371:
URL: https://github.com/apache/daffodil-vscode/pull/371#discussion_r1049023004


##########
src/utils.ts:
##########
@@ -173,6 +173,19 @@ export async function executeScript(
   return terminal
 }
 
+export async function stopJavaProcess(processName: string) {
+  // Stop debugger if running
+  if (os.platform() === 'win32') {
+    // Windows stop debugger if already running
+    child_process.execSync('tskill java 2>nul 1>nul || echo "Java not 
running"')
+  } else {
+    // Linux/Mac stop debugger if already running and make sure script is 
executable
+    child_process.exec(
+      `kill -9 $(ps -ef | grep '${processName}' | grep 'jar' | awk '{ print $2 
}') || return 0`
+    ) // ensure debugger server not running and
+  }
+}

Review Comment:
   Take a look at [spawnd](https://www.npmjs.com/package/spawnd).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to