Perl could certainly use a hook triggering before exec(). Performing custom setup between fork() and exec() is essential for correct operation in many scenarios. For example: thread save calling an external command, Re^6: Capture::Tiny alternative.
So the IPC modules might use constructs like
But this would no doubt have other creative uses. Syntactic sugar to make things neat.{ local $SIG{__EXEC__} = \&_do_redirect; system ... }
{ use redirect qw( 3>&1 1>&2 2>&3 3>&- ); open my $fh, ...; `another cmd`; }
ps. I'm not entirely sure if the hook ought to be post-fork or pre-exec.
In reply to Re: Improve pipe open? (redirect hook)
by oiskuu
in thread Improve pipe open?
by afoken
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |