Commit 5ce5344
chloekek
Promote
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;
}std.process.Config.preExecFunction to a delegate1 parent 4b2ea30 commit 5ce5344
File tree
2 files changed
+56
-2
lines changed- changelog
- std
2 files changed
+56
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1271 | 1271 | | |
1272 | 1272 | | |
1273 | 1273 | | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
1274 | 1290 | | |
1275 | 1291 | | |
1276 | 1292 | | |
| |||
2188 | 2204 | | |
2189 | 2205 | | |
2190 | 2206 | | |
2191 | | - | |
| 2207 | + | |
2192 | 2208 | | |
2193 | 2209 | | |
2194 | 2210 | | |
2195 | | - | |
| 2211 | + | |
2196 | 2212 | | |
2197 | 2213 | | |
2198 | 2214 | | |
| |||
0 commit comments