On Thursday, 16 May 2019 at 17:19:13 UTC, Vladimir Panteleev wrote:
On Thursday, 16 May 2019 at 17:18:01 UTC, Alex wrote:
adding

        int dup(int) @trusted;
        int dup2(int, int) @trusted;
        int close(int) @trusted;
        int open(in char*, int, ...) @trusted;

Be sure to make them extern(C).

Sorry, I haven't tried it, I'm guessing that it should work based on:
https://github.com/digitalmars/dmc/blob/master/include/io.h#L142-L147

Ok, the issue is because I was adding

        import core.stdc.stdio, core.stdc.stdio;
        extern (C):
                @system:
                nothrow:
                @nogc:
                static int _dup(int);
                static int dup2(int, int);

directly inside the PushFD struct... I marked them static and it still didn't help. I don't know it's adding the class for the lookup:

PushFD!(1).PushFD.dup2(int, int)" (_D3mM__T6PushFDVii1ZQm4dup2UNbNiiiZi)

Unfortunately the code is crashing because _open or _sopen is returning -1 for /dev/null

Works fine nul, NUL, and CONOUT$ but does not block the output.


I'm not sure if they are failing to block or if they are blocking what is being opened(and not the original console). That is, do I need to not open and simply close stdout?



Reply via email to