Francois Gouget : testbot/TestAgent: Simplify running and waiting for a remote command.

Alexandre Julliard julliard at winehq.org
Tue Jan 11 15:42:55 CST 2022


Module: tools
Branch: master
Commit: fb6efdbd9146196406e9521aa1d1a65f1a50318c
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=fb6efdbd9146196406e9521aa1d1a65f1a50318c

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Tue Jan 11 19:20:06 2022 +0100

testbot/TestAgent: Simplify running and waiting for a remote command.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 0aa59da..fea7e65 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 @_;




More information about the wine-cvs mailing list