Skip to content

Conversation

@alt-romes
Copy link
Collaborator

Introduces exception TerminateServer which, if thrown by a debugger session, is re-thrown to the main thread to terminate the server.

This is useful if you are using the server in one-shot mode (only one execution per server)

This is based on #10

mpickering and others added 2 commits May 2, 2025 11:04
To implement OutputEvents we may need to capture the stdout and stderr
of the debuggee. However, if the DAP server is also outputting to stdout
and stderr its messages will be mixed up with the debuggee's.

This commit introduces a logging action to ensure it is possible to
redirect all of the DAP server's output to a particular handle, thereby
separating it from the debuggee.

Fixes haskell-debugger#9
Introduces exception `TerminateServer` which, if thrown by a debugger
session, is re-thrown to the main thread to terminate the server.

This is useful if you are using the server in one-shot mode (only one
execution per server)
Comment on lines +146 to +151
| Just TerminateServer <- fromException e
= do
logger logAction ERROR address Nothing
$ withBraces
$ T.pack ("Server terminated!")
throwTo serverThread (SomeAsyncException TerminateServer)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌🏼

@dmjio dmjio merged commit 9fb399b into haskell-debugger:master May 3, 2025
1 check passed
@dmjio
Copy link
Contributor

dmjio commented May 3, 2025

@alt-romes hope I didn't prematurely merge this

@alt-romes
Copy link
Collaborator Author

alt-romes commented May 3, 2025

No, that's alright!

I'll close the other one since this one included that commit too.

EDIT: Already has been closed automatically.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants