-
-
Notifications
You must be signed in to change notification settings - Fork 147
Description
Transferred from: https://issues.dlang.org/show_bug.cgi?id=18423
User @WebDrake reported (2018-02-11 16:22:46 CET):
When
rdmdinvokes the D compiler to generate dependencies information, it makes a hardcoded assumption that this information gets written by the compiler tostdout. However, this assumption is not valid for all D compilers. In particular, compiler frontend messages are written out to a configurablestdmsg: dlang/dmd@dc8421f... and this configurability is used by GDC to output such messages to
stderr(reflecting GCC policy thatstdoutis reserved for-pipeoutput; see: #297 (comment)).This means not only that
rdmdwill not work with more recent GDC releases, but thatrdmd's assumptions aboutstdoutare not valid in general (given the configurablestdmsgin the DMD frontend).The gory details
The
getDependenciesfunction insiderdmd.dinvokes the D compiler via theruncommand, passing in options (thedepsGettervariable) and the name of a file to which to write the compiler output (depsFilename):immutable depsExitCode = run(depsGetter, depsFilename);Internally,
runtakes this and usesspawnProcessto invoke the D compiler:private int run(string[] args, string output = null, bool replace = false) { ... File outputFile; if (output.ptr) outputFile = File(output, "wb"); else outputFile = stdout; auto process = spawnProcess(args, stdin, outputFile); return process.wait(); }In other words,
runopens a file whose name is given bydepsFilename, and uses it to replacestdoutfor the spawned process. The contents of this file are then read using the nestedreadDepsFile()function defined internally insidegetDependencies.In consequence, if the information parsed by
readDepsFileis not written tostdoutby the D compiler, it will not get written intooutputFile, and therefore not be available to parse.
User @WebDrake responded (2018-02-11 16:30:16 CET):
For context, this issue was observed while trying to update rdmd's integration tests to use gdmd: #307 (comment)
Marking as enhancement since things work at the moment and this is to support a new feature.