dub build output redirect
Steven Schveighoffer
schveiguy at gmail.com
Tue Jun 8 13:51:10 UTC 2021
On 6/8/21 8:38 AM, seany wrote:
> I have compiled a complex project via `dub build`.
>
> I used both `-b release` and `-b debug`.
>
> But i cant redirect the output (generated by `writeln`) to a file.
>
> I call by : `./executable --param p1 > a`. But execution hangs
> immediately. If I do `./executable --param p1 ` no issue.
>
> What am I doing wrong?
>
> thank you.
Are you expecting input as well as sending output?
A common behavior difference between console streams and file streams
(including in D) is that when the library detects it's sending to a
console, it flushes buffered output after every newline. When it's
sending to a file (or other stream type), it only sends output when the
buffer is full (usually about 4k bytes).
The hang sounds like it has buffered up its output ready to send, and
then is waiting for input to continue.
-Steve
More information about the Digitalmars-d-learn
mailing list