Re: [PATCH] fmt-merge-msg: avoid open "-|" list form for Perl 5.6

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric Wong
Date: Friday, February 24, 2006 - 5:02 am

Alex Riesen <raa.lkml@gmail.com> wrote:

It seems that ActiveState has more problems with pipes than it does with fork.
If it supports redirects reasonably well, this avoids pipes entirely and
may be more stable as a result (but possibly slower):

# IO::File is standard in Perl 5.x, new_tmpfile
# returns an open filehandle to an already unlinked file

use IO::File;
my $out = IO::File->new_tmpfile;
file
my $pid = fork;
defined $pid or die $!;
if (!$pid) {
	# redirects STDOUT to $out file
	open STDOUT, '>&', $out or die $!;
	exec('foo','bar');
}
waitpid $pid, 0;
seek $out, 0, 0;
while (<$out>) {
	...
}

Writing and reading from a tempfile are very fast for me in Linux, and probably
not much slower than pipes.  Of course I'm still assuming file descriptors stay
shared after a 'fork', which may be asking too much on Windows.  Using something
from File::Temp to get a temp filename would still work.

-- 
Eric Wong
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Should we support Perl 5.6?, Johannes Schindelin, (Mon Feb 20, 11:37 am)
Re: Should we support Perl 5.6?, Eric Wong, (Mon Feb 20, 12:10 pm)
Re: Should we support Perl 5.6?, Andreas Ericsson, (Mon Feb 20, 2:01 pm)
Re: Should we support Perl 5.6?, Junio C Hamano, (Mon Feb 20, 2:15 pm)
Re: [PATCH] fmt-merge-msg: avoid open "-|" list form for P ..., Eric Wong, (Fri Feb 24, 5:02 am)
NT directory traversal speed on 25K files on Cygwin, Rutger Nijlunsing, (Sun Feb 26, 4:17 pm)
Re: NT directory traversal speed on 25K files on Cygwin, Christopher Faylor, (Sun Feb 26, 6:18 pm)
Re: NT directory traversal speed on 25K files on Cygwin, Andreas Ericsson, (Mon Feb 27, 2:19 am)
Re: NT directory traversal speed on 25K files on Cygwin, Rutger Nijlunsing, (Mon Feb 27, 11:30 am)
Re: NT directory traversal speed on 25K files on Cygwin, Christopher Faylor, (Mon Feb 27, 11:34 am)
Re: NT directory traversal speed on 25K files on Cygwin, Rutger Nijlunsing, (Mon Feb 27, 11:45 am)