in reply to Bad file descriptor error in Win32 VC2015 compiled perl-5.20.3

My suggestion: print the value of fileno(STDOUT) just prior to the open.

The OS error message: "Bad file descriptor"; suggests that STDOUT has been closed prior to the flow arriving at that open statement; and you can't dup a closed file handle.

If you get nothing (undef) rather than 2, then you'll need to step back and work out where the filehandle is being closed.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re: Bad file descriptor error in Win32 VC2015 compiled perl-5.20.3
  • Download Code

Replies are listed 'Best First'.
Re^2: Bad file descriptor error in Win32 VC2015 compiled perl-5.20.3
by shadowsong (Pilgrim) on Mar 22, 2016 at 15:17 UTC

    BrowserUk,

    Thank you very much indeed.

    I was able to use fileno to output the integer value associated with STDOUT just prior to the open call [as well as just prior to the subroutine call which contains said open call]

    modified Builder.pm with diagnostic print statements

    installation attempt which triggers the diagnostic print

    observations

    • The STDOUT file descriptor is associated with 1
    • Notice the diagnostic print is sent to STDERR? This is because attempts to send it to STDOUT resulted in nothing being displayed…
    • I have built this on a 64bit Win10 system with VC2015 RC2 without encountering this issue
    • I rebuilt perl-5.20.3 on this system using VC2015 RC2 (just to be certain I used the same tools that yielded a successful build)

    So, although the STDOUT is 1 - the fact that printing to it yields no output; signifies something is definitely wrong with it.

    Thanks again for your help - I feel much better about it now and I learned a new function.

    Cheers,
    Shadowsong