Revision: 54fd82b82ba4
Branch:   default
Author:   Janne Piironen <janne.piiro...@gmail.com>
Date:     Wed Oct 16 12:37:59 2013 UTC
Log:      Made Terminate Process return result object

Update issue 1543
Status: Review
Owner: janne.piiro...@gmail.com
Implemented return result object for Terminate Process. It is similar
to return object from Wait For Process keyword
http://code.google.com/p/robotframework/source/detail?r=54fd82b82ba4

Modified:
 /atest/testdata/standard_libraries/process/terminate_and_pid.txt
 /src/robot/libraries/Process.py

=======================================
--- /atest/testdata/standard_libraries/process/terminate_and_pid.txt Wed Oct 16 12:25:25 2013 UTC +++ /atest/testdata/standard_libraries/process/terminate_and_pid.txt Wed Oct 16 12:37:59 2013 UTC
@@ -18,16 +18,18 @@
 Killing process
     ${handle}=    Some process
     Process Should Be Running
-    Terminate Process    ${handle}    kill=${True}
+    ${result} =    Terminate Process    ${handle}    kill=${True}
     Wait For Process    ${handle}
     Process Should Be Stopped    ${handle}
+    Should Not Be Equal As Integers    ${result.rc}    0

 Terminating process
     ${handle}=    Some process
     Process Should Be Running
-    Terminate Process    ${handle}
+    ${result} =    Terminate Process    ${handle}
     Wait For Process    ${handle}
     Process Should Be Stopped    ${handle}
+    Should Not Be Equal As Integers     ${result.rc}    0

 Kill Process When Terminate Fails
     ${lib} =    Get Library Instance    Process
@@ -39,6 +41,7 @@
     ${result} =    Terminate Process    ${process}
     Wait For Process    ${process}
     Process Should Be Stopped    ${process}
+    Should Not Be Equal As Integers    ${result.rc}    0

 Pid
     ${handle}=    Some process
=======================================
--- /src/robot/libraries/Process.py     Wed Oct 16 12:25:25 2013 UTC
+++ /src/robot/libraries/Process.py     Wed Oct 16 12:37:59 2013 UTC
@@ -384,14 +384,19 @@
         be forcefully killed.

         See `Stopping process` for more details.
+
+ Returns a `result object` containing information about the execution.
         """
         process = self._processes[handle]
+        result = self._results[process]
         if not hasattr(process, 'terminate'):
             raise RuntimeError('Terminating processes is not supported '
                                'by this interpreter version.')
terminator = self._kill_process if kill else self._terminate_process
         try:
             terminator(process)
+            result.rc = process.wait() or 0
+            return result
         except OSError:
             if not self._process_is_stopped(process, self._kill_timeout):
                 raise

--

--- You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to