[p4] Terminal output in p4v tools
Rick Macdonald
rickmacd at shaw.ca
Mon Nov 12 14:20:01 PST 2007
I must have found this with Google, because I don't know perl, but this
works for me:
my( $oldHandle );
# Force a flush on STDOUT
$oldHandle = select (STDOUT); # "select" STDOUT and save previously
selected handle
$| = 1; # perform flush after each write to STDOUT
select ($oldHandle); # restore previously selected handle
...RickM...
Gross, Steve wrote:
> Hi folks. I had an interesting problem that you might find handy: my
> custom tool generates a lot of output (both to stdout and stderr) during
> an execution time of 10+ seconds. However, the p4v terminal window only
> displayed ALL of the output at the END of execution, rather than
> delivering the messages one by one as they occurred.
>
> This had the unfortunate effect of making users wonder whether the
> program was running at all! That is, they would spawn the tool, get an
> empty terminal window, and no output for awhile. Ack!
>
> I found an interesting solution: after every message is delivered (er,
> printed) to stdout or stderr in my tool, I flush the appropriate buffer.
> This works like a charm!
>
> Interesting, huh?
>
> --Steve
>
> _______________________________________________
> perforce-user mailing list - perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>
>
More information about the perforce-user
mailing list