Skip to content

Commit

Permalink
fix: Check if Unix Domain socket file exists before listening.
Browse files Browse the repository at this point in the history
  • Loading branch information
zobo committed Aug 21, 2023
1 parent 10ed918 commit 6af1325
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/phpDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,9 @@ class PhpDebugSession extends vscode.DebugSession {
throw new Error('Cannot have port and socketPath set at the same time')
}
if (args.hostname?.toLowerCase()?.startsWith('unix://') === true) {
if (fs.existsSync(args.hostname.substring(7))) {
throw new Error(`File ${args.hostname.substring(7)} exists and cannot be used for Unix Domain socket`)
}
server.listen(args.hostname.substring(7))
} else if (args.hostname?.startsWith('\\\\') === true) {
server.listen(args.hostname)
Expand Down

0 comments on commit 6af1325

Please sign in to comment.