www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22523] New: DRuntime options passed after -- affect current

https://issues.dlang.org/show_bug.cgi?id=22523

          Issue ID: 22523
           Summary: DRuntime options passed after -- affect current
                    process
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: moonlightsentinel disroot.org

[1] changed Druntime's argument parsing to forward `--DRT-` options after `--`
to `main`. But those options still affect the current process!

Example:

==============================================================
// test.d

import core.stdc.stdio;

int main()
{
    puts("Executed main although it should be skipped!");
    return 1;
}

unittest {} // Prevents main to be executed by default

==============================================================

 dmd -unittest test.d
 ./test -- --DRT-testmode=run-main
Executed main although it should be skipped! [1] https://github.com/dlang/druntime/pull/2881 --
Nov 18 2021