Skip to content

Commit

Permalink
Add a popup on hl exit 4 (debug port occupied)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxiaomao committed May 20, 2024
1 parent a90331f commit ffcddbb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/HLAdapter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ class HLAdapter extends DebugSession {

function launch( args : Arguments, response : LaunchResponse ) {

var hlArgs = ["--debug", "" + (args.port == null ? debugPort : args.port), args.program];
var port = args.port == null ? debugPort : args.port;
var hlArgs = ["--debug", "" + port, args.program];

if( doDebug )
hlArgs.unshift("--debug-wait");
Expand Down Expand Up @@ -279,6 +280,13 @@ class HLAdapter extends DebugSession {
sendEvent(exitedEvent);
sendEvent(new TerminatedEvent());
stopDebug();
if( code == 4 ) {
var msg = "hl exit code 4, please check if the debug port " + port + " is already occupied.";
errorMessage(msg);
#if vscode
Vscode.window.showErrorMessage(msg, {modal: true});
#end
}
});
proc.on('error', function(err) {
if( err.message == "spawn hl ENOENT" )
Expand Down

0 comments on commit ffcddbb

Please sign in to comment.