Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the IO-Pty-Easy CPAN distribution.

Report information
The Basics
Id: 113038
Status: resolved
Priority: 0/
Queue: IO-Pty-Easy

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.09
Fixed in: (no value)



Subject: spawn() returns 0 if standard input is not a TTY
Documentation reads: =head2 spawn(@argv) Fork a new subprocess, with stdin/stdout/stderr tied to the pty. The argument list is passed directly to C<exec()>. Returns true on success, false on failure. That's true if perl's standard input is a TTY: $ perl -Ilib -e 'use IO::Pty::Easy; my $pty=IO::Pty::Easy->new; my $r=$pty->spawn(q{true}); warn $r; $pty->close' 1 at -e line 1. But if the standard input is not a TTY, it returns false despite everything works: $ perl -Ilib -e 'use IO::Pty::Easy; my $pty=IO::Pty::Easy->new; my $r=$pty->spawn(q{true}); warn $r; $pty->close' </dev/null 0 at -e line 1. The reason is new() checks for TTY: $handle_pty_size = 0 unless POSIX::isatty(*STDIN); and then spawn() finishes with: if ($self->handle_pty_size) { my $weakself = weaken($self); $SIG{WINCH} = sub { return unless $weakself; $weakself->slave->clone_winsize_from(\*STDIN); kill WINCH => $weakself->pid if $weakself->is_active; }; ${*{$self}}{io_pty_easy_did_handle_pty_size} = 1; } So the return value is a value of the last executed command that is an assignment of 1. I believe the spawn() croaks on any error, therefore documentation is wrong and the return value is meaning less. Am I right?
This is actually a documentation bug, which I had fixed quite a while ago and then forgot to actually release. I've released 0.10 with updated docs for the spawn method.