# from Ken Williams
# on Sunday 04 February 2007 07:13 pm:

>On Feb 1, 2007, at 5:42 PM, Andreas J. Koenig wrote:
>> The offending line:
>>
>> +  return $ENV{PERL_MM_USE_DEFAULT} || ( !$self->_is_interactive &&
>> eof STDIN );
>>
>> This hangs forever when the STDOUT is redirected and STDIN is not
>> redirected.
>
>Indeed.
>
>I think I've got a reasonable fix, does it look reasonable to you?
>Of course, STDIN could be something more exotic like a tied fh, and
>then I guess we'd be at the mercy of whomever tied it...
>
>I found this by looking in the perl source for the smallest wrapper
>around the PerlIOValid() macro.
>+  return $ENV{PERL_MM_USE_DEFAULT}
>+         || ( !$self->_is_interactive && !defined fileno STDIN );

From my experiment, this doesn't change the behavior.  It just causes it 
to hang later in _readline() instead.

 return $ENV{PERL_MM_USE_DEFAULT} ||
  ( !$self->_is_interactive && (-t STDIN ? 1 : eof(STDIN));

I think this gives you the correct answer for _is_unattended() -- where 
STDOUT is being redirected, we are unattended unless we're being fed a 
set of scripted answers on STDIN.

--Eric
-- 
hobgoblin n 1: (folklore) a small grotesque supernatural creature that
          makes trouble for human beings
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------

Reply via email to