Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CPAN-Reporter CPAN distribution.

Report information
The Basics
Id: 34526
Status: resolved
Priority: 0/
Queue: CPAN-Reporter

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

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



Subject: Use Unix script command instead of IO::CaptureOutput
On system with a working script(1) command it could be preferable to use this command instead of IO::CaptureOutput. It seems that script is perfectly emulating a terminal while capturing all of the output. I made a test with the Curses::Widgets testsuite and it does not garble the screen. Regards, Slaven
On Sat Mar 29 10:20:59 2008, SREZIC wrote: Show quoted text
> On system with a working script(1) command it could be preferable to use > this command instead of IO::CaptureOutput. It seems that script is > perfectly emulating a terminal while capturing all of the output. I made > a test with the Curses::Widgets testsuite and it does not garble the
screen. Show quoted text
>
I made now a test by monkeypatching a Tee.pm using script(1) into CPAN::Reporter (see the attached module). The test suite has now some failures (13_record_command.t and 14_command_timeout.t), but it seems to be \r-related: both the visible output and the logfile now have \n translated into \r\n. But maybe this can be neglected i.e. accepted in the test suite. A real test with Curses::Widgets seemed to work ok. Regards, Slaven
#!/usr/bin/perl -w # -*- perl -*- use base 'Exporter'; use vars qw(@EXPORT); @EXPORT = qw(tee); sub tee { die "Need three-argument style of tee" if @_ != 3; my($command, $options, $file) = @_; die "Need stderr turned on " if !$options->{stderr}; system("script -q $file $command"); } 1; __END__
On Sun Apr 20 14:56:03 2008, SREZIC wrote: Show quoted text
> On Sat Mar 29 10:20:59 2008, SREZIC wrote:
> > On system with a working script(1) command it could be preferable to use > > this command instead of IO::CaptureOutput. It seems that script is > > perfectly emulating a terminal while capturing all of the output. I made > > a test with the Curses::Widgets testsuite and it does not garble the
> screen.
> >
> > I made now a test by monkeypatching a Tee.pm using script(1) into > CPAN::Reporter (see the attached module).
This will probably work only under BSD systems. I tested it with FreeBSD. Linux has another script syntax. If I recall correctly, instead of system("script -q $file $command"); it should probably be something like system("script", "-c", $command, $file); (including a quiet option, if there is any) Regards, Slaven
The current implementation in the repo now uses Capture::Tiny. I'd be interested in hearing if it addresses the issue. Otherwise, it will have to stay wishlist until someone has tuits to write a portable way to execute script.