Skip Menu |

This queue is for tickets about the POE CPAN distribution.

Report information
The Basics
Id: 4793
Status: resolved
Priority: 0/
Queue: POE

People
Owner: Nobody in particular
Requestors: richter [...] ecos.de
Cc:
AdminCc:

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



From: "Gerald Richter" <richter [...] ecos.de>
To: <poe [...] perl.org>
Subject: Re: [PATCH] Set window size for pty in Wheel::Run
Date: Tue, 30 Dec 2003 13:37:36 +0100
Hi, Show quoted text
> > I have made a small patch against POE 0.27 which let you set the > window size for a pty for a process started with POE::Wheel::Run.
Unfortunately my first patch does not work correctly when STDIN isn't tty. Here is an updated version of the patch, which also does the right thing, when the POE process runs in the background, i.e. doesn't have a STDIN. Gerald 8192/44695 16384/44695 24576/44695 32768/44695 40960/44695 44695/44695 44695/44695 Index: Run.pm =================================================================== --- Run.pm (revision 96) +++ Run.pm (working copy) @@ -152,6 +152,10 @@ $conduit = "pipe"; } + my $winsize = delete $params{Winsize}; + croak "Winsize needs to be an array ref" + if (defined ($winsize) && ref ($winsize) ne 'ARRAY') ; + my $stdin_event = delete $params{StdinEvent}; my $stdout_event = delete $params{StdoutEvent}; my $stderr_event = delete $params{StderrEvent}; @@ -305,9 +309,12 @@ # Set the pty conduit (slave side) window size to our window # size. APITUE 19.4 and 19.5. if (defined TIOCGWINSZ) { - if (-t STDIN) { - my $window_size = '!' x 25; + my $window_size = '!' x 25; + if (-t STDIN && !$winsize) { ioctl( STDIN, TIOCGWINSZ, $window_size ) or die $!; + } + $window_size = pack ('SSSS', @$winsize) if (ref $winsize) ; + if ($window_size ne '!' x 25) { ioctl( $stdin_read, TIOCSWINSZ, $window_size ) or die $!; } else { @@ -1096,6 +1103,16 @@ Pty conduits require the IO::Pty module. +=item Winsize + +C<Winsize> is only valid for C<Conduit = pty> and used to set the window +size of the pty device. The window size +is given as an array reference. +The first element is the number of lines, the +second the number of columns. The third and the fourth optional argument +can give the x and y width in pixels. + + =item CloseOnCall C<CloseOnCall> emulates the close-on-exec feature for child processes -------------------------------------------------------------- Gerald Richter ecos electronic communication services gmbh IT-Securitylösungen * dynamische Webapplikationen * Consulting Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz E-Mail: richter@ecos.de Voice: +49 6133 939-122 WWW: http://www.ecos.de/ Fax: +49 6133 939-333 -------------------------------------------------------------- | | ECOS BB-5000 Firewall- und IT-Security Appliance: www.bb-5000.info | +-------------------------------------------------------------
Patch applied; thanks again! -- Rocco Caputo - rcaputo@pobox.com - http://poe.perl.org/