[tools 1/2] testbot/TestAgent: Simplify running and waiting for a remote command.
Francois Gouget
fgouget at codeweavers.com
Tue Jan 11 12:20:06 CST 2022
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
testbot/lib/WineTestBot/TestAgent.pm | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/testbot/lib/WineTestBot/TestAgent.pm b/testbot/lib/WineTestBot/TestAgent.pm
index 0aa59da573..fea7e650e1 100644
--- a/testbot/lib/WineTestBot/TestAgent.pm
+++ b/testbot/lib/WineTestBot/TestAgent.pm
@@ -1354,6 +1354,30 @@ sub Wait($$$;$)
return $Result;
}
+=pod
+=over 12
+
+=item C<RunAndWait()>
+
+Starts the specified command and waits for it to complete, returning its exit
+code or a negative value if running or waiting for it failed.
+
+Note: The TestAgent-side error codes make it so that in most cases any non-zero
+ return value indicates that the command did not run successfully.
+
+=back
+=cut
+
+sub RunAndWait($$$;$$$$$)
+{
+ my ($self, $Argv, $Flags, $WaitTimeout, $ServerInPath, $ServerOutPath, $ServerErrPath, $Keepalive) = @_;
+
+ my $Pid = $self->Run($Argv, $Flags, $ServerInPath, $ServerOutPath, $ServerErrPath);
+ return -1 if (!$Pid);
+ my $Ret = $self->Wait($Pid, $WaitTimeout, $Keepalive);
+ return defined $Ret ? $Ret : -2;
+}
+
sub Rm($@)
{
my $self = shift @_;
--
2.30.2
More information about the wine-devel
mailing list