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


##########
src/daffodilDebugger.ts:
##########
@@ -120,18 +120,8 @@ export async function getDebugger(
         await unzipFile(filePath, rootPath)
       }
 
-      // 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 'daffodil' | grep 'jar' | awk '{ print $2 
}') || return 0"
-        ) // ensure debugger server not running and
-      }
+      // stop java program -- in this case the debugger
+      await stopJavaProcess('daffodil')

Review Comment:
   Refactoring this as a utility function is a good idea.  Instead of sending 
in the process _name_, instead send it the process ID to be more targeted and 
safe about the process killing.



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