[tmcode commit] r315 - spine/branches/spine_2_2-devel/lib/Spine/Util

0 views
Skip to first unread message

oss...@gmail.com

unread,
Mar 30, 2010, 11:28:15 AM3/30/10
to tmcode...@googlegroups.com
Author: richard
Date: Tue Mar 30 08:28:15 2010
New Revision: 315

Log:
Allow timeouts of <1second on readline Ticket #115

Modified:
spine/branches/spine_2_2-devel/lib/Spine/Util/Exec.pm

Modified: spine/branches/spine_2_2-devel/lib/Spine/Util/Exec.pm
==============================================================================
--- spine/branches/spine_2_2-devel/lib/Spine/Util/Exec.pm Tue Mar 30 08:24:28 2010 (r314)
+++ spine/branches/spine_2_2-devel/lib/Spine/Util/Exec.pm Tue Mar 30 08:28:15 2010 (r315)
@@ -25,6 +25,7 @@
use Scalar::Util qw(blessed);
use IO::Select;
use IO::Handle;
+use Time::HiRes qw(ualarm);
use POSIX ":sys_wait_h";
use Spine::Constants qw(:basic);
use File::Spec::Functions;
@@ -38,7 +39,7 @@
# quiet => <HIDE ERRORS>
# exec => <WHAT TO EXEC>
# args => <ARGS>
-# merge_error => <JOIN STDERR to SEDOUT>
+# merge_error => <JOIN STDERR to STDOUT>
# c => <Spine::Data object>
# inert => <RUN WHEN IN DRYRUN>
sub new {
@@ -107,7 +108,7 @@

# create a new error descripter unless we
# are merging out and error
- if ( !exists $settings{merge_error} &&
+ if ( exists $settings{merge_error} &&
$settings{merge_error} ) {
$err = $out;
}
@@ -119,7 +120,6 @@
$self->{out} = $out;
$self->{err} = $err;

- # at this point
return $self;
}

@@ -134,7 +134,6 @@

my $c = $self->{c} if exists $self->{c};

- # FIXME:
# spine should deal with reporting this error, we can't
# since the error functions are within Spine::Data.
# perhaps error reporting should be a singlton?
@@ -314,9 +313,9 @@
my $line = undef;
eval {
$SIG{ALRM} = sub { die "timeout" };
- alarm($timeout || 0);
+ ualarm(($timeout || 0) * 1000000);
$line = $self->{$type}->getline();
- alarm(0);
+ ualarm(0);
};
if ($@) {
$self->{last_error} = "$@";

Reply all
Reply to author
Forward
0 new messages