mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 06:30:28 +03:00
Fix Issue 22125 - std.process.Config was changed to a struct but miss operator overloads
This commit is contained in:
parent
19003dd639
commit
baf6ede6de
1 changed files with 23 additions and 2 deletions
|
@ -2131,9 +2131,20 @@ struct Config
|
||||||
enum Config inheritFDs = Config(Flags.inheritFDs); /// ditto
|
enum Config inheritFDs = Config(Flags.inheritFDs); /// ditto
|
||||||
enum Config detached = Config(Flags.detached); /// ditto
|
enum Config detached = Config(Flags.detached); /// ditto
|
||||||
enum Config stderrPassThrough = Config(Flags.stderrPassThrough); /// ditto
|
enum Config stderrPassThrough = Config(Flags.stderrPassThrough); /// ditto
|
||||||
Config opBinary(string op : "|")(Config other)
|
Config opUnary(string op)()
|
||||||
|
if (is(typeof(mixin(op ~ q{flags}))))
|
||||||
{
|
{
|
||||||
return Config(flags | other.flags);
|
return Config(mixin(op ~ q{flags}));
|
||||||
|
} /// ditto
|
||||||
|
Config opBinary(string op)(Config other)
|
||||||
|
if (is(typeof(mixin(q{flags} ~ op ~ q{other.flags}))))
|
||||||
|
{
|
||||||
|
return Config(mixin(q{flags} ~ op ~ q{other.flags}));
|
||||||
|
} /// ditto
|
||||||
|
Config opOpAssign(string op)(Config other)
|
||||||
|
if (is(typeof(mixin(q{flags} ~ op ~ q{=other.flags}))))
|
||||||
|
{
|
||||||
|
return Config(mixin(q{flags} ~ op ~ q{=other.flags}));
|
||||||
} /// ditto
|
} /// ditto
|
||||||
|
|
||||||
version (StdDdoc)
|
version (StdDdoc)
|
||||||
|
@ -2151,6 +2162,16 @@ struct Config
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://issues.dlang.org/show_bug.cgi?id=22125
|
||||||
|
@safe unittest
|
||||||
|
{
|
||||||
|
Config c = Config.retainStdin;
|
||||||
|
c |= Config.retainStdout;
|
||||||
|
c |= Config.retainStderr;
|
||||||
|
c &= ~Config.retainStderr;
|
||||||
|
assert(c == (Config.retainStdin | Config.retainStdout));
|
||||||
|
}
|
||||||
|
|
||||||
/// A handle that corresponds to a spawned process.
|
/// A handle that corresponds to a spawned process.
|
||||||
final class Pid
|
final class Pid
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue