in reply to (WIN) Autoflush, Perl, Sleep and Powershell

OK, this seems to be a problem with some powershell buffering.

If I print with a newline at the end the output shows directly.

PS D:\tmp> perl -E'$|=1;print qq($]\n);sleep 10' > tmp.log Terminating on signal SIGINT(2) PS D:\tmp> cat .\tmp.log 5.032001 PS D:\tmp> perl -E'$|=1;print qq($]);sleep 10' > tmp.log Terminating on signal SIGINT(2) PS D:\tmp> cat .\tmp.log PS D:\tmp>

weird ...

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^2: (WIN) Autoflush, Perl, Sleep and Powershell
by Anonymous Monk on May 14, 2021 at 18:03 UTC
    Newline characters (and what happens when you don't have them) are a known headache with PowerShell. If your string always ends with a newline it will be written timely.
      > If your string always ends with a newline it will be written timely.

      Okay..

      Do you have a reference, please?

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

        of course he doesn't.