scholarsmate commented on code in PR #1364:
URL: https://github.com/apache/daffodil-vscode/pull/1364#discussion_r2294388659
##########
src/dataEditor/dataEditorClient.ts:
##########
@@ -1193,7 +1195,28 @@ function generateLogbackConfigFile(
}
async function serverStart() {
- await serverStop()
+ // Check for stale PID file
+ const serverPidFile = getPidFile(omegaEditPort)
+ if (fs.existsSync(getPidFile(omegaEditPort))) {
+ const pid = parseInt(fs.readFileSync(serverPidFile).toString())
+ // Ensure PID isn't assigned to a different process before stopping process
+ if (
+ child_process
+ .execSync(
+ osCheck(
+ `tasklist`,
+ `ps -a | grep ${pid} | grep -v grep | awk '{print $2}'`
+ )
+ )
+ .toString('ascii')
+ .toLowerCase()
+ .includes('omega-edit')
+ ) {
Review Comment:
For Linux and macOS, use ` ps -p 1234 -o comm= | grep -Fq 'omega-edit'` what
is there doesn't work. Column 2 is the TTY in both cases.
--
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]