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


##########
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:
   If the extension is _managing_ these server processes, what it starts up, it 
shall also shut down.
   
   If there is _already_ a daffodil-debugger service running _on the same port_ 
as configured in VS Code, then consider it _unmanaged_ and use it as-is, and 
don't shut it down when the debugging session is done.  The same applies to the 
Ωedit server.  This way the extension _cooperates_ with different instances of 
the servers if they are running and listening to the configured port, otherwise 
it will use our internal versions as managed processes.



-- 
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