Use redirection of stderr to null

This commit is contained in:
Andrei Alexandrescu 2020-09-20 13:53:35 -04:00
parent e28ac3c61d
commit 5da48602d8
2 changed files with 23 additions and 16 deletions

View file

@ -3122,7 +3122,20 @@ private auto executeImpl(alias pipeFunc, Cmd, ExtraPipeFuncArgs...)(
auto r3 = executeShell("exit 123");
assert(r3.status == 123);
assert(r3.output.empty);
auto r4 = executeShell("echo -n '\r' 1>&2",
}
unittest
{
// Temporarily disable output to stderr so as to not spam the build log.
import std.stdio : stderr;
auto t = stderr;
version (Posix)
stderr.open("/dev/null", "w");
else
stderr.open("nul", "w");
scope(exit) stderr = t;
auto r4 = executeShell("echo This line should not be visible. 1>&2",
null, Config.stderrPassThrough);
assert(r4.status == 0);
assert(r4.output.empty);