in reply to Tieing STDERR to a textbox causes the IPC::Run start function to fail

Sounds like fileno( STDERR ) is called by start and the tied file handle doesn't provide a FILENO callback for it.

Replies are listed 'Best First'.
Re^2: Tieing STDERR to a textbox causes the IPC::Run start function to fail
by ikegami (Patriarch) on Mar 06, 2026 at 04:21 UTC

    Indeed, there's this:

    sub _debug_fd { return fileno STDERR unless defined $cur_self; if ( _debugging && !defined $cur_self->{DEBUG_FD} ) { my $fd = select STDERR; $| = 1; select $fd; $cur_self->{DEBUG_FD} = POSIX::dup fileno STDERR; _debug("debugging fd is $cur_self->{DEBUG_FD}\n") if _debugging_details; } return fileno STDERR unless defined $cur_self->{DEBUG_FD}; return $cur_self->{DEBUG_FD}; }

    It's called a number of places as follows or similar:

    $op->open_pipe( $self->_debug_fd )

    It seems it's used to provide a means for post-fork but pre-exec code in the child to display debug messages without causing issues if the child's STDERR is redirected. For example, you wouldn't want some of the debug messages of run \@cmd, "2>", "err.txt" to end up on STDERR and some of them to end up in `err.txt`.

      That makes sense - thanks very much!