Proper way to exit with specific exit code?
mw
mingwu at gmail.com
Sun Nov 13 22:42:45 UTC 2022
On Sunday, 13 November 2022 at 22:17:32 UTC, mw wrote:
> On Sunday, 13 November 2022 at 22:06:09 UTC, Imperatorn wrote:
>> On Sunday, 13 November 2022 at 21:37:47 UTC, mw wrote:
>>> On Sunday, 13 November 2022 at 21:16:32 UTC, mw wrote:
>>>
>>>> I even tried core.stdc.stdlib.exit(-1), it does not work.
>>>
>>> Tried
>>> ```
>>> import core.runtime;
>>> Runtime.terminate();
>>> core.stdc.stdlib.exit(-1);
>>> ```
>>>
>>> Still does not work.
>>
>> I have no idea why it would fail. What about assert(0)?
>
>
> I guess these two calls somehow only terminate the calling
> thread (? this is strange for core.stdc.stdlib.exit), the whole
> program just hangs after the call, and can only be terminated
> by `kill -9`.
>
>
> I have to manually go thru each of the treads and plug in some
> kind of early exit logic to stop the whole program.
>
>
> Will try assert(0) later.
tried:
```
core.runtime.Runtime.terminate();
core.stdc.stdlib.exit(-1);
assert(0);
enforce(false);
```
Still not working, not even "Ctrl+C", have to `kill -9` to
terminate it.
More information about the Digitalmars-d-learn
mailing list