Re: [repost] Patch to make cpdup's stdout unbuffered
--Apple-Mail-12-1052934089
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII; format=flowed
On 09.06.2004, at 00:19, Chris Pressey wrote:
>>> The installer popen()'s "cpdup -vvv src dest" and it reads from this
>>> pipe to monitor cpdup's progress. Unfortunately, since cpdup's
>>> output is fully buffered, cpdup's progress can't be usefully
>>> measured this way.
>> Now, we could add a flag for every single program to write unbuffered
>> (linebuffered) output. Or we could do some (non-POSIX?) magic in libc
>> to get most of this just fixed by doing a env
>> LIBC_STDOUT_BUFFERING=line $program or whatever...
> The man pages make it sound a bit like this is already possible, but I
> can't figure out how to do it.
> So by the sounds of it, the attached program should be able to run
> another program, forcing that other program's stdout to be unbufferred.
> But in (a small amount of) testing, I couldn't seem to get that
> behaviour.
The buffering is done in the FILE* functions in libc, not on
STDOUT_FILENO in the kernel.
This is why we need to tell *libc* not to buffer; this has nothing to
do with the fd as I understand it.
cheers
simon
--
/"\
\ /
\ ASCII Ribbon Campaign
/ \ Against HTML Mail and News
--Apple-Mail-12-1052934089
content-type: application/pgp-signature; x-mac-type=70674453;
name=PGP.sig
content-description: This is a digitally signed message part
content-disposition: inline; filename=PGP.sig
content-transfer-encoding: 7bit
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFAxj/vr5S+dk6z85oRAoI1AKCcgVfMj3VQXr8fUBJXcdCVOggsNACfQzxr
WlohDvfFb+dFYQ2s7e4sDiA=
=8xix
-----END PGP SIGNATURE-----
--Apple-Mail-12-1052934089--
討論串 (同標題文章)
完整討論串 (本文為第 4 之 9 篇):