https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98494

            Bug ID: 98494
           Summary: libphobos: std.process Config.stderrPassThrough
                    missing
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: witold.baryluk+gcc at gmail dot com
  Target Milestone: ---

It appears that gdc version of libphobos is somehow lagging in some aspects
behind upstream.

One of the things I see missing, is `Config.stderrPassThrough` in std.process.
I see it was added upstream about 12 months ago:

enum Config {
...
    /**
    By default, the $(LREF execute) and $(LREF executeShell) functions
    will capture child processes' both stdout and stderr. This can be
    undesirable if the standard output is to be processed or otherwise
    used by the invoking program, as `execute`'s result would then
    contain a mix of output and warning/error messages.

    Specify this flag when calling `execute` or `executeShell` to
    cause invoked processes' stderr stream to be sent to $(REF stderr,
    std,stdio), and only capture and return standard output.

    This flag has no effect on $(LREF spawnProcess) or $(LREF spawnShell).
    */
    stderrPassThrough = 128,
}

The implementation usage of this is relatively small and easy to backport:

in executeImpl:

-    auto p = pipeFunc(commandLine, Redirect.stdout | Redirect.stderrToStdout,
-                      env, config, workDir, extraArgs);
+    auto redirect = (config & Config.stderrPassThrough)
+        ? Redirect.stdout
+        : Redirect.stdout | Redirect.stderrToStdout;
+
+    auto p = pipeFunc(commandLine, redirect,
+                      env, config, workDir, extraArgs);



There are some other minor changes there, but nothing functionally significant.
Mostly unittests and minor signature changes (adding `scope` to many input
parameters).

Thank you.

Reply via email to