質問

I have a static constructor like this:

File errorLog;
static this() {
    try {
        errorLog = File("./log/log.txt", "w");
    } catch(Throwable ex) {
        // STOP PROGRAM EXECUTION
    }
}

How would I stop the program execution when the opening of the file fails?

役に立ちましたか?

解決

Use core.runtime to terminate druntime http://dlang.org/phobos/core_runtime.html#.Runtime.terminate and exit from core.stdc.stdlib

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top