On Sunday, 16 January 2022 at 18:22:04 UTC, Steven Schveighoffer wrote:

Does this work normally? The memory error handler for Linux jumps through a lot of hoops to be able to throw an error from a signal handler. See https://github.com/dlang/druntime/blob/master/src/etc/linux/memoryerror.d

It worked when I tested it, but I'm not sure how reliable it is. A more conservative implementation would be something like

```d
extern(C) void handleCtrlC(int)
{
        import core.stdc.stdlib: exit;
        import std.stdio: writeln;

        try throw new Exception("Killed by CTRL+C");
        catch (Exception e)
        {
                writeln(e.message);
                writeln(e.info);
                exit(1);
        }
}
```

Reply via email to