Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Promote
std.process.Config.preExecFunction
to a delegate
std.process.Config.preExecFunction is now a delegate instead of a function pointer, and can therefore capture an environment, for example: import core.sys.linux.sys.prctl : PR_SET_PDEATHSIG, prctl; import std.process : Config, execute; void runProgram(int pdeathsig) { execute( ["program"], config: Config( preExecFunction: () @trusted => prctl(PR_SET_PDEATHSIG, pdeathsig, 0, 0, 0) != -1, ), ); } Despite function pointers implicitly converting to delegates, this is a backwards-incompatible change, as user code may rely on the field being a function pointer. For example, code like the following will no longer compile: import std.process : Config; nothrow pure @nogc @safe bool f() { return true; } void example() { auto config = Config(preExecFunction: &f); bool function() g = config.preExecFunction; }
- Loading branch information