Cannot call @system funciton (stdout)

Anonymouse zorael at gmail.com
Sat Sep 19 13:56:53 UTC 2020


On Saturday, 19 September 2020 at 13:32:07 UTC, Paul Backus wrote:
> On Saturday, 19 September 2020 at 13:23:29 UTC, Anonymouse 
> wrote:
>> On Tuesday, 18 August 2020 at 06:25:31 UTC, Kagamin wrote:
>>> On Sunday, 16 August 2020 at 18:13:07 UTC, Anonymouse wrote:
>>>> Just as a drive-by comment, the main stdio thing I came 
>>>> across that I couldn't do from within @safe was 
>>>> stdout.flush(), which I need to call manually for Cygwin 
>>>> terminals and some terminals embedded in editors (vscode). 
>>>> If someone knows why, please tell me.
>>>
>>> Cygwin terminals are not recognized as terminals, you should 
>>> set line buffered mode, then it will flush every line.
>>
>> How do I do this?
>
> http://dpldocs.info/experimental-docs/std.stdio.File.setvbuf.1.html

Thanks.

I don't have a clone of druntime/Phobos available to me right 
now, so some follow-up questions.

It looks like full buffering _IOFBF is the default setting, but 
"normal" non-Cygwin stdio certainly seems to do line buffering. 
Is it getting set to line buffering _IOLBF during initialisation 
of stdout? (Why then is Cygwin exempt?)

Is there a way to detect programmatically if I'm in an 
environment where I need to manually set line buffering?



More information about the Digitalmars-d-learn mailing list