7 new revisions:

Revision: 7c9a6c2194bc
Branch:   default
Author:   Pekka Klärck
Date:     Thu Mar  6 21:34:37 2014 UTC
Log: Process: Explicit test sfor terminating/killing also child processes....
http://code.google.com/p/robotframework/source/detail?r=7c9a6c2194bc

Revision: 3a2f47f3b874
Branch:   default
Author:   Pekka Klärck
Date:     Thu Mar  6 22:19:35 2014 UTC
Log: Process tests: Seperate suite for tests related to active process, sep...
http://code.google.com/p/robotframework/source/detail?r=3a2f47f3b874

Revision: d8713cbbb22b
Branch:   default
Author:   Pekka Klärck
Date:     Thu Mar  6 22:21:50 2014 UTC
Log: Process tests: renamed terminate suite now that it has no pid tests
http://code.google.com/p/robotframework/source/detail?r=d8713cbbb22b

Revision: d32498f829c3
Branch:   default
Author:   Pekka Klärck
Date:     Mon Mar 10 09:24:39 2014 UTC
Log:      Process tests: reuse countdown test script with signal tests
http://code.google.com/p/robotframework/source/detail?r=d32498f829c3

Revision: e687eee65162
Branch:   default
Author:   Pekka Klärck
Date:     Mon Mar 10 09:54:20 2014 UTC
Log: Process: Cleanup code related to terminating also child processes...
http://code.google.com/p/robotframework/source/detail?r=e687eee65162

Revision: 1bdfda9647a0
Branch:   default
Author:   Pekka Klärck
Date:     Mon Mar 10 10:12:37 2014 UTC
Log:      Process: Tuning docs.
http://code.google.com/p/robotframework/source/detail?r=1bdfda9647a0

Revision: 4765c1acdd4c
Branch:   default
Author:   Pekka Klärck
Date:     Mon Mar 10 10:21:34 2014 UTC
Log:      Process: Add support for sending signals to whole process group...
http://code.google.com/p/robotframework/source/detail?r=4765c1acdd4c

==============================================================================
Revision: 7c9a6c2194bc
Branch:   default
Author:   Pekka Klärck
Date:     Thu Mar  6 21:34:37 2014 UTC
Log: Process: Explicit test sfor terminating/killing also child processes.

This was already indectly tested by testing that processes running on a shell are terminated/killed.

Also renamed and reorganized tests a little.
http://code.google.com/p/robotframework/source/detail?r=7c9a6c2194bc

Modified:
 /atest/robot/standard_libraries/process/terminate_and_pid.txt
 /atest/testdata/standard_libraries/process/files/countdown.py
 /atest/testdata/standard_libraries/process/terminate_and_pid.txt

=======================================
--- /atest/robot/standard_libraries/process/terminate_and_pid.txt Thu Mar 6 20:21:46 2014 UTC +++ /atest/robot/standard_libraries/process/terminate_and_pid.txt Thu Mar 6 21:34:37 2014 UTC
@@ -8,39 +8,45 @@
 Run process does not change active process
     Check Test Case    ${TESTNAME}

-Killing process
+Terminate process
     ${tc} =    Check Test Case    ${TESTNAME}
- Check Log Message ${tc.kws[1].msgs[0]} Forcefully killing process. + Check Log Message ${tc.kws[1].msgs[0]} Gracefully terminating process.

-Terminating process
+Kill process
     ${tc} =    Check Test Case    ${TESTNAME}
- Check Log Message ${tc.kws[1].msgs[0]} Gracefully terminating process. + Check Log Message ${tc.kws[1].msgs[0]} Forcefully killing process.

-Killing process running on shell
+Terminate process running on shell
     Check Test Case    ${TESTNAME}

-Terminating process running on shell
+Kill process running on shell
     Check Test Case    ${TESTNAME}

-Kill Process When Terminate Fails
+Also child processes are terminated
+    Check Test Case    ${TESTNAME}
+
+Also child processes are killed
+    Check Test Case    ${TESTNAME}
+
+Kill process when terminate fails
     ${tc} =    Check Test Case    ${TESTNAME}
Check Log Message ${tc.kws[5].msgs[0]} Gracefully terminating process. Check Log Message ${tc.kws[5].msgs[1]} Graceful termination failed. Check Log Message ${tc.kws[5].msgs[2]} Forcefully killing process.
     Should Be True    ${tc.elapsedtime} >= 2000
-
-Terminate All Processes
-    ${tc} =    Check Test Case    ${TESTNAME}
- Check Log Message ${tc.kws[14].msgs[0]} Gracefully terminating process.
-
-Terminate All Empties Cache
-    Check Test Case    ${TESTNAME}

 Terminating already terminated process is ok
     Check Test Case    ${TESTNAME}

 Waiting for terminated process is ok
     Check Test Case    ${TESTNAME}
+
+Terminate all processes
+    ${tc} =    Check Test Case    ${TESTNAME}
+ Check Log Message ${tc.kws[14].msgs[0]} Gracefully terminating process.
+
+Terminating all empties cache
+    Check Test Case    ${TESTNAME}

 Pid
     Check Test Case    ${TESTNAME}
=======================================
--- /atest/testdata/standard_libraries/process/files/countdown.py Thu Mar 6 20:21:46 2014 UTC +++ /atest/testdata/standard_libraries/process/files/countdown.py Thu Mar 6 21:34:37 2014 UTC
@@ -1,11 +1,23 @@
 from __future__ import with_statement
+import subprocess
 import sys
 import time

-path = sys.argv[1]
-with open(path, 'w') as f:
-    for i in range(10, 0, -1):
-        f.write('%d\n' % i)
-        f.flush()
-        time.sleep(0.1)
-    f.write('BLASTOFF')
+
+def countdown(path):
+    with open(path, 'w') as f:
+        for i in range(10, 0, -1):
+            f.write('%d\n' % i)
+            f.flush()
+            time.sleep(0.1)
+        f.write('BLASTOFF')
+
+
+if __name__ == '__main__':
+    path = sys.argv[1]
+    children = int(sys.argv[2]) if len(sys.argv) == 3 else 0
+
+    if children:
+ subprocess.Popen([sys.executable, __file__, path, str(children-1)]).wait()
+    else:
+        countdown(path)
=======================================
--- /atest/testdata/standard_libraries/process/terminate_and_pid.txt Thu Mar 6 20:21:46 2014 UTC +++ /atest/testdata/standard_libraries/process/terminate_and_pid.txt Thu Mar 6 21:34:37 2014 UTC
@@ -19,44 +19,41 @@
     ${id}=    Get Process Id
     Should Be Equal    ${expected id}    ${id}

-Killing process
+Terminate process
     ${handle}=    Some process
-    ${result} =    Terminate Process    ${handle}    kill=true
+    ${result} =    Terminate Process    ${handle}
     Process Should Be Stopped    ${handle}
-    Should Not Be Equal As Integers    ${result.rc}    0
+    Should Not Be Equal As Integers     ${result.rc}    0
     Should Be Empty    ${result.stdout}
     Should Be Empty    ${result.stderr}

-Terminating process
+Kill process
     ${handle}=    Some process
-    ${result} =    Terminate Process    ${handle}
+    ${result} =    Terminate Process    ${handle}    kill=true
     Process Should Be Stopped    ${handle}
-    Should Not Be Equal As Integers     ${result.rc}    0
+    Should Not Be Equal As Integers    ${result.rc}    0
     Should Be Empty    ${result.stdout}
     Should Be Empty    ${result.stderr}

-Killing process running on shell
+Terminate process running on shell
+    Start Process    python    ${COUNTDOWN}    ${TEMPFILE}    shell=True
+    Terminate should stop countdown
+
+Kill process running on shell
     Check Precondition    os.sep == '/'
     Start Process    python    ${COUNTDOWN}    ${TEMPFILE}    shell=True
-    Wait Until Created    ${TEMPFILE}
-    Terminate Process    kill=yes
-    ${content1} =    Get File    ${TEMPFILE}
-    Should Not Contain    ${content1}    BLASTOFF
-    Sleep    0.2
-    ${content2} =    Get File    ${TEMPFILE}
-    Should Be Equal    ${content1}    ${content2}
+    Terminate should stop countdown    kill=yes

-Terminating process running on shell
-    Start Process    python    ${COUNTDOWN}    ${TEMPFILE}    shell=True
-    Wait Until Created    ${TEMPFILE}
-    Terminate Process
-    ${content1} =    Get File    ${TEMPFILE}
-    Should Not Contain    ${content1}    BLASTOFF
-    Sleep    0.2
-    ${content2} =    Get File    ${TEMPFILE}
-    Should Be Equal    ${content1}    ${content2}
+Also child processes are terminated
+    Start Process    python    ${COUNTDOWN}    ${TEMPFILE}    3
+    Terminate should stop countdown
+
+Also child processes are killed
+    Check Precondition    os.sep == '/'
+    Start Process    python    ${COUNTDOWN}    ${TEMPFILE}    3
+    Terminate should stop countdown    kill=${True}

-Kill Process When Terminate Fails
+Kill process when terminate fails
     ${lib} =    Get Library Instance    Process
     ${lib.TERMINATE_TIMEOUT} =    Set Variable    ${2}
     ${lib.KILL_TIMEOUT} =    Set Variable    ${1}
@@ -76,7 +73,7 @@
     Terminate Process    ${handle}
     Wait For Process    ${handle}

-Terminate All Processes
+Terminate all processes
     ${h1}=    Some process
     ${h2}=    Some process
     ${h3}=    Some process
@@ -99,7 +96,7 @@
     \    ${poll}=    Call Method    ${process}    poll
     \    Should Not Be Equal    ${poll}    ${NONE}

-Terminate All Empties Cache
+Terminating all empties cache
     Some process
     Terminate All Processes    kill=True
     ${handle} =    Some Process
@@ -120,3 +117,15 @@
     ${pid3}=      Get Process Id   ${handle}
     Should Be Equal As Integers   ${pid1}   ${pid2}
     Should Be Equal As Integers   ${pid1}   ${pid3}
+
+*** Keywords ***
+Terminate should stop countdown
+    [Arguments]    ${kill}=false
+    Wait Until Created    ${TEMPFILE}
+    Terminate Process    kill=${kill}
+    ${content1} =    Get File    ${TEMPFILE}
+    Should Not Contain    ${content1}    BLASTOFF
+    Sleep    0.2
+    ${content2} =    Get File    ${TEMPFILE}
+    Should Be Equal    ${content1}    ${content2}
+

==============================================================================
Revision: 3a2f47f3b874
Branch:   default
Author:   Pekka Klärck
Date:     Thu Mar  6 22:19:35 2014 UTC
Log: Process tests: Seperate suite for tests related to active process, separated pid tests from terminate tests
http://code.google.com/p/robotframework/source/detail?r=3a2f47f3b874

Added:
 /atest/robot/standard_libraries/process/active_process.txt
 /atest/testdata/standard_libraries/process/active_process.txt
Modified:
 /atest/robot/standard_libraries/process/process_library.txt
 /atest/robot/standard_libraries/process/terminate_and_pid.txt
 /atest/testdata/standard_libraries/process/process_library.txt
 /atest/testdata/standard_libraries/process/resource.txt
 /atest/testdata/standard_libraries/process/terminate_and_pid.txt

=======================================
--- /dev/null
+++ /atest/robot/standard_libraries/process/active_process.txt Thu Mar 6 22:19:35 2014 UTC
@@ -0,0 +1,23 @@
+*** Settings ***
+Suite Setup Run Tests ${EMPTY} standard_libraries/process/active_process.txt
+Force Tags       regression    pybot    jybot
+Resource         atest_resource.txt
+
+*** Test Cases ***
+Implicit handle
+    Check Test Case    ${TESTNAME}
+
+Explicit handle
+    Check Test Case    ${TESTNAME}
+
+Alias
+    Check Test Case    ${TESTNAME}
+
+Implicit handle, explicit handle, and alias are equivalent
+    Check Test Case    ${TESTNAME}
+
+Switching active process
+    Check Test Case    ${TESTNAME}
+
+Run Process does not change active process
+    Check Test Case    ${TESTNAME}
=======================================
--- /dev/null
+++ /atest/testdata/standard_libraries/process/active_process.txt Thu Mar 6 22:19:35 2014 UTC
@@ -0,0 +1,48 @@
+*** Settings ***
+Resource          resource.txt
+
+*** Test Cases ***
+Implicit handle
+    Some process
+    ${stdout} =    Stop some process    message=my message
+    Should Be Equal    ${stdout}    my message
+
+Explicit handle
+    ${handle} =    Some process
+    ${stdout} =    Stop some process    ${handle}    my message
+    Should Be Equal    ${stdout}    my message
+
+Alias
+    Some process    alias=saila
+    ${stdout} =    Stop some process    saila    my message
+    Should Be Equal    ${stdout}    my message
+
+Implicit handle, explicit handle, and alias are equivalent
+    ${handle}=    Some process    alias=saila
+    ${pid by implicit handle} =    Get process id
+    ${pid by explicit handle} =    Get process id    ${handle}
+    ${pid by alias} =    Get process id    saila
+ Should Be Equal ${pid by implicit handle} ${pid by explicit handle}
+    Should Be Equal    ${pid by implicit handle}    ${pid by alias}
+
+Switching active process
+    Some process    one
+    Some process    two
+    Stop Some Process    one
+    Process Should Be Running
+    Process Should Be Running    two
+    Process Should Be Stopped    one
+    Switch Process    one
+    Process Should Be Stopped
+    Switch Process    two
+    Process Should Be Running
+    Stop Some Process
+    Process Should Be Stopped
+    Process Should Be Stopped    two
+
+Run Process does not change active process
+    Some process    active
+    ${id1}=    Get Process Id
+    Run Python Process    1+1
+    ${id2}=    Get Process Id
+    Should Be Equal    ${id1}    ${id2}
=======================================
--- /atest/robot/standard_libraries/process/process_library.txt Tue Jan 28 22:16:40 2014 UTC +++ /atest/robot/standard_libraries/process/process_library.txt Thu Mar 6 22:19:35 2014 UTC
@@ -17,9 +17,6 @@

 Start And Wait Process
     Check Test Case    ${TESTNAME}
-
-Switching active process
-    Check Test Case    ${TESTNAME}

 Change Current Working Directory
     Check Test Case    ${TESTNAME}
@@ -54,5 +51,6 @@
 Input things to process
     Check Test Case    ${TESTNAME}

-Process alias
+Get process id
+    [Setup]    Check Precondition
     Check Test Case    ${TESTNAME}
=======================================
--- /atest/robot/standard_libraries/process/terminate_and_pid.txt Thu Mar 6 21:34:37 2014 UTC +++ /atest/robot/standard_libraries/process/terminate_and_pid.txt Thu Mar 6 22:19:35 2014 UTC
@@ -5,9 +5,6 @@
 Resource         process_resource.txt

 *** Test Cases ***
-Run process does not change active process
-    Check Test Case    ${TESTNAME}
-
 Terminate process
     ${tc} =    Check Test Case    ${TESTNAME}
Check Log Message ${tc.kws[1].msgs[0]} Gracefully terminating process.
@@ -47,9 +44,3 @@

 Terminating all empties cache
     Check Test Case    ${TESTNAME}
-
-Pid
-    Check Test Case    ${TESTNAME}
-
-Getting PIDs in different ways should give same result
-    Check Test Case    ${TESTNAME}
=======================================
--- /atest/testdata/standard_libraries/process/process_library.txt Tue Jan 28 22:16:40 2014 UTC +++ /atest/testdata/standard_libraries/process/process_library.txt Thu Mar 6 22:19:35 2014 UTC
@@ -22,17 +22,6 @@
     Process Should Be Running    ${handle}
     Wait For Process    ${handle}
     Process Should Be Stopped    ${handle}
-
-Switching active process
-    ${process_one}=    Some process    one
-    Stop Some Process    one
-    ${process_two}=    Some process    two
-    Process Should Be Running    ${process_two}
-    Switch Process    one
-    Process Should Be Stopped
-    Switch Process    two
-    Process Should Be Running
-    Stop Some Process

 Change Current Working Directory
${result}= Run Process python -c import os; print os.path.abspath(os.curdir); cwd=.
@@ -98,11 +87,13 @@
     ${result}=    Wait For Process
     Should Match    ${result.stdout}    *inp some input*

-Process alias
- ${handle}= Start Process python -c "print 'hello'" shell=True alias=hello
-    ${pid_by_handle}=    Get process id    ${handle}
-    ${pid_by_alias}=    Get process id    hello
-    Should Be Equal    ${pid_by_handle}    ${pid_by_alias}
+Get process id
+    Check Precondition    not sys.platform.startswith('java')
+    ${handle}=    Some process
+    ${pid}=    Get Process Id    ${handle}
+    Should Not Be Equal   ${pid}   ${None}
+ Evaluate os.kill(int(${pid}),signal.SIGTERM) if hasattr(os, 'kill') else os.system('taskkill /pid ${pid} /f') os,signal
+    Wait For Process    ${handle}

 *** Keywords ***
 Restart Suite Process If Needed
=======================================
--- /atest/testdata/standard_libraries/process/resource.txt Wed Jan 29 07:34:35 2014 UTC +++ /atest/testdata/standard_libraries/process/resource.txt Thu Mar 6 22:19:35 2014 UTC
@@ -10,16 +10,17 @@
 *** Keywords ***
 Some process
     [Arguments]    ${alias}=${null}
-    ${handle}=    Start Python Process    raw_input()    alias=${alias}
+ ${handle}= Start Python Process print raw_input() alias=${alias} stderr=STDOUT
     Process should be running
     [Return]    ${handle}

 Stop some process
-    [Arguments]    ${alias}=${null}
-    ${running}=    Is Process Running    ${alias}
+    [Arguments]    ${handle}=${null}    ${message}=
+    ${running}=    Is Process Running    ${handle}
     Return From Keyword If    not ${running}
-    ${process}=    Get Process Object    ${alias}
-    Call Method    ${process}    communicate    stop\n
+    ${process}=    Get Process Object    ${handle}
+ ${stdout} ${_} = Call Method ${process} communicate ${message}\n
+    [Return]    ${stdout.rstrip()}

 Result should equal
     [Arguments]    ${result}    ${stdout}=    ${stderr}=    ${rc}=0
=======================================
--- /atest/testdata/standard_libraries/process/terminate_and_pid.txt Thu Mar 6 21:34:37 2014 UTC +++ /atest/testdata/standard_libraries/process/terminate_and_pid.txt Thu Mar 6 22:19:35 2014 UTC
@@ -12,13 +12,6 @@
 ${TEMPFILE}       %{TEMPDIR}${/}terminate-process-temp.txt

 *** Test Cases ***
-Run process does not change active process
-    Some process    active
-    ${expected id}=    Get Process Id
-    Run Python Process    1+1
-    ${id}=    Get Process Id
-    Should Be Equal    ${expected id}    ${id}
-
 Terminate process
     ${handle}=    Some process
     ${result} =    Terminate Process    ${handle}
@@ -101,22 +94,6 @@
     Terminate All Processes    kill=True
     ${handle} =    Some Process
     Should Be Equal    ${handle}    ${1}
-
-Pid
-    ${handle}=    Some process
-    ${pid}=    Get Process Id    ${handle}
-    Should Not Be Equal   ${pid}   ${None}
- Evaluate os.kill(int(${pid}),signal.SIGTERM) if hasattr(os, 'kill') else os.system('taskkill /pid ${pid} /f') os,signal
-    Wait For Process    ${handle}
-    Process Should Be Stopped    ${handle}
-
-Getting PIDs in different ways should give same result
- ${handle}= Start Process python -c "print 'hello'" shell=True alias=hello
-    ${pid1}=      Get Process Id
-    ${pid2}=      Get Process Id   hello
-    ${pid3}=      Get Process Id   ${handle}
-    Should Be Equal As Integers   ${pid1}   ${pid2}
-    Should Be Equal As Integers   ${pid1}   ${pid3}

 *** Keywords ***
 Terminate should stop countdown

==============================================================================
Revision: d8713cbbb22b
Branch:   default
Author:   Pekka Klärck
Date:     Thu Mar  6 22:21:50 2014 UTC
Log: Process tests: renamed terminate suite now that it has no pid tests
http://code.google.com/p/robotframework/source/detail?r=d8713cbbb22b

Added:
 /atest/robot/standard_libraries/process/terminate_process.txt
 /atest/testdata/standard_libraries/process/terminate_process.txt
Deleted:
 /atest/robot/standard_libraries/process/terminate_and_pid.txt
 /atest/testdata/standard_libraries/process/terminate_and_pid.txt

=======================================
--- /dev/null
+++ /atest/robot/standard_libraries/process/terminate_process.txt Thu Mar 6 22:21:50 2014 UTC
@@ -0,0 +1,46 @@
+*** Settings ***
+Suite Setup Run Tests ${EMPTY} standard_libraries/process/terminate_process.txt
+Test Setup       Check Precondition
+Force Tags       regression    pybot    jybot
+Resource         process_resource.txt
+
+*** Test Cases ***
+Terminate process
+    ${tc} =    Check Test Case    ${TESTNAME}
+ Check Log Message ${tc.kws[1].msgs[0]} Gracefully terminating process.
+
+Kill process
+    ${tc} =    Check Test Case    ${TESTNAME}
+ Check Log Message ${tc.kws[1].msgs[0]} Forcefully killing process.
+
+Terminate process running on shell
+    Check Test Case    ${TESTNAME}
+
+Kill process running on shell
+    Check Test Case    ${TESTNAME}
+
+Also child processes are terminated
+    Check Test Case    ${TESTNAME}
+
+Also child processes are killed
+    Check Test Case    ${TESTNAME}
+
+Kill process when terminate fails
+    ${tc} =    Check Test Case    ${TESTNAME}
+ Check Log Message ${tc.kws[5].msgs[0]} Gracefully terminating process. + Check Log Message ${tc.kws[5].msgs[1]} Graceful termination failed. + Check Log Message ${tc.kws[5].msgs[2]} Forcefully killing process.
+    Should Be True    ${tc.elapsedtime} >= 2000
+
+Terminating already terminated process is ok
+    Check Test Case    ${TESTNAME}
+
+Waiting for terminated process is ok
+    Check Test Case    ${TESTNAME}
+
+Terminate all processes
+    ${tc} =    Check Test Case    ${TESTNAME}
+ Check Log Message ${tc.kws[14].msgs[0]} Gracefully terminating process.
+
+Terminating all empties cache
+    Check Test Case    ${TESTNAME}
=======================================
--- /dev/null
+++ /atest/testdata/standard_libraries/process/terminate_process.txt Thu Mar 6 22:21:50 2014 UTC
@@ -0,0 +1,108 @@
+*** Settings ***
+Test Setup        Run Keywords
+...               Check Precondition    sys.version_info >= (2,6)    AND
+...               Remove File    ${TEMPFILE}
+Test Teardown     Terminate All Processes    kill=True
+Library           Collections
+Resource          resource.txt
+
+*** Variables ***
+${NONTERM}        ${CURDIR}${/}files${/}non_terminable.py
+${COUNTDOWN}      ${CURDIR}${/}files${/}countdown.py
+${TEMPFILE}       %{TEMPDIR}${/}terminate-process-temp.txt
+
+*** Test Cases ***
+Terminate process
+    ${handle}=    Some process
+    ${result} =    Terminate Process    ${handle}
+    Process Should Be Stopped    ${handle}
+    Should Not Be Equal As Integers     ${result.rc}    0
+    Should Be Empty    ${result.stdout}
+    Should Be Empty    ${result.stderr}
+
+Kill process
+    ${handle}=    Some process
+    ${result} =    Terminate Process    ${handle}    kill=true
+    Process Should Be Stopped    ${handle}
+    Should Not Be Equal As Integers    ${result.rc}    0
+    Should Be Empty    ${result.stdout}
+    Should Be Empty    ${result.stderr}
+
+Terminate process running on shell
+    Start Process    python    ${COUNTDOWN}    ${TEMPFILE}    shell=True
+    Terminate should stop countdown
+
+Kill process running on shell
+    Check Precondition    os.sep == '/'
+    Start Process    python    ${COUNTDOWN}    ${TEMPFILE}    shell=True
+    Terminate should stop countdown    kill=yes
+
+Also child processes are terminated
+    Start Process    python    ${COUNTDOWN}    ${TEMPFILE}    3
+    Terminate should stop countdown
+
+Also child processes are killed
+    Check Precondition    os.sep == '/'
+    Start Process    python    ${COUNTDOWN}    ${TEMPFILE}    3
+    Terminate should stop countdown    kill=${True}
+
+Kill process when terminate fails
+    ${lib} =    Get Library Instance    Process
+    ${lib.TERMINATE_TIMEOUT} =    Set Variable    ${2}
+    ${lib.KILL_TIMEOUT} =    Set Variable    ${1}
+ ${process} = Start Process python ${NONTERM} ${TEMPFILE} stderr=STDOUT
+    Wait Until Created    ${TEMPFILE}
+    ${result} =    Terminate Process    ${process}    kill=false
+    Should Not Be Equal As Integers    ${result.rc}    0
+ Should Start With ${result.stdout} Starting non-terminable process.
+
+Terminating already terminated process is ok
+    ${handle}=    Some process
+    Terminate Process    ${handle}
+    Terminate Process    ${handle}
+
+Waiting for terminated process is ok
+    ${handle}=    Some process
+    Terminate Process    ${handle}
+    Wait For Process    ${handle}
+
+Terminate all processes
+    ${h1}=    Some process
+    ${h2}=    Some process
+    ${h3}=    Some process
+    ${h4}=    Some process
+    ${h5}=    Some process
+    Sleep    0.1
+    ${p1}=    Get Process Object    ${h1}
+    ${p2}=    Get Process Object    ${h2}
+    ${p3}=    Get Process Object    ${h3}
+    ${p4}=    Get Process Object    ${h4}
+    ${p5}=    Get Process Object    ${h5}
+    :FOR    ${process}    IN    ${p1}    ${p2}    ${p3}    ${p4}    ${p5}
+    \    ${poll}=    Call Method    ${process}    poll
+    \    Should Be Equal    ${poll}    ${NONE}
+    Switch Process    ${h3}
+    Terminate Process    ${h2}
+    Terminate All Processes
+    Sleep    0.1
+    :FOR    ${process}    IN    ${p1}    ${p2}    ${p3}    ${p4}    ${p5}
+    \    ${poll}=    Call Method    ${process}    poll
+    \    Should Not Be Equal    ${poll}    ${NONE}
+
+Terminating all empties cache
+    Some process
+    Terminate All Processes    kill=True
+    ${handle} =    Some Process
+    Should Be Equal    ${handle}    ${1}
+
+*** Keywords ***
+Terminate should stop countdown
+    [Arguments]    ${kill}=false
+    Wait Until Created    ${TEMPFILE}
+    Terminate Process    kill=${kill}
+    ${content1} =    Get File    ${TEMPFILE}
+    Should Not Contain    ${content1}    BLASTOFF
+    Sleep    0.2
+    ${content2} =    Get File    ${TEMPFILE}
+    Should Be Equal    ${content1}    ${content2}
+
=======================================
--- /atest/robot/standard_libraries/process/terminate_and_pid.txt Thu Mar 6 22:19:35 2014 UTC
+++ /dev/null
@@ -1,46 +0,0 @@
-*** Settings ***
-Suite Setup Run Tests ${EMPTY} standard_libraries/process/terminate_and_pid.txt
-Test Setup       Check Precondition
-Force Tags       regression    pybot    jybot
-Resource         process_resource.txt
-
-*** Test Cases ***
-Terminate process
-    ${tc} =    Check Test Case    ${TESTNAME}
- Check Log Message ${tc.kws[1].msgs[0]} Gracefully terminating process.
-
-Kill process
-    ${tc} =    Check Test Case    ${TESTNAME}
- Check Log Message ${tc.kws[1].msgs[0]} Forcefully killing process.
-
-Terminate process running on shell
-    Check Test Case    ${TESTNAME}
-
-Kill process running on shell
-    Check Test Case    ${TESTNAME}
-
-Also child processes are terminated
-    Check Test Case    ${TESTNAME}
-
-Also child processes are killed
-    Check Test Case    ${TESTNAME}
-
-Kill process when terminate fails
-    ${tc} =    Check Test Case    ${TESTNAME}
- Check Log Message ${tc.kws[5].msgs[0]} Gracefully terminating process. - Check Log Message ${tc.kws[5].msgs[1]} Graceful termination failed. - Check Log Message ${tc.kws[5].msgs[2]} Forcefully killing process.
-    Should Be True    ${tc.elapsedtime} >= 2000
-
-Terminating already terminated process is ok
-    Check Test Case    ${TESTNAME}
-
-Waiting for terminated process is ok
-    Check Test Case    ${TESTNAME}
-
-Terminate all processes
-    ${tc} =    Check Test Case    ${TESTNAME}
- Check Log Message ${tc.kws[14].msgs[0]} Gracefully terminating process.
-
-Terminating all empties cache
-    Check Test Case    ${TESTNAME}
=======================================
--- /atest/testdata/standard_libraries/process/terminate_and_pid.txt Thu Mar 6 22:19:35 2014 UTC
+++ /dev/null
@@ -1,108 +0,0 @@
-*** Settings ***
-Test Setup        Run Keywords
-...               Check Precondition    sys.version_info >= (2,6)    AND
-...               Remove File    ${TEMPFILE}
-Test Teardown     Terminate All Processes    kill=True
-Library           Collections
-Resource          resource.txt
-
-*** Variables ***
-${NONTERM}        ${CURDIR}${/}files${/}non_terminable.py
-${COUNTDOWN}      ${CURDIR}${/}files${/}countdown.py
-${TEMPFILE}       %{TEMPDIR}${/}terminate-process-temp.txt
-
-*** Test Cases ***
-Terminate process
-    ${handle}=    Some process
-    ${result} =    Terminate Process    ${handle}
-    Process Should Be Stopped    ${handle}
-    Should Not Be Equal As Integers     ${result.rc}    0
-    Should Be Empty    ${result.stdout}
-    Should Be Empty    ${result.stderr}
-
-Kill process
-    ${handle}=    Some process
-    ${result} =    Terminate Process    ${handle}    kill=true
-    Process Should Be Stopped    ${handle}
-    Should Not Be Equal As Integers    ${result.rc}    0
-    Should Be Empty    ${result.stdout}
-    Should Be Empty    ${result.stderr}
-
-Terminate process running on shell
-    Start Process    python    ${COUNTDOWN}    ${TEMPFILE}    shell=True
-    Terminate should stop countdown
-
-Kill process running on shell
-    Check Precondition    os.sep == '/'
-    Start Process    python    ${COUNTDOWN}    ${TEMPFILE}    shell=True
-    Terminate should stop countdown    kill=yes
-
-Also child processes are terminated
-    Start Process    python    ${COUNTDOWN}    ${TEMPFILE}    3
-    Terminate should stop countdown
-
-Also child processes are killed
-    Check Precondition    os.sep == '/'
-    Start Process    python    ${COUNTDOWN}    ${TEMPFILE}    3
-    Terminate should stop countdown    kill=${True}
-
-Kill process when terminate fails
-    ${lib} =    Get Library Instance    Process
-    ${lib.TERMINATE_TIMEOUT} =    Set Variable    ${2}
-    ${lib.KILL_TIMEOUT} =    Set Variable    ${1}
- ${process} = Start Process python ${NONTERM} ${TEMPFILE} stderr=STDOUT
-    Wait Until Created    ${TEMPFILE}
-    ${result} =    Terminate Process    ${process}    kill=false
-    Should Not Be Equal As Integers    ${result.rc}    0
- Should Start With ${result.stdout} Starting non-terminable process.
-
-Terminating already terminated process is ok
-    ${handle}=    Some process
-    Terminate Process    ${handle}
-    Terminate Process    ${handle}
-
-Waiting for terminated process is ok
-    ${handle}=    Some process
-    Terminate Process    ${handle}
-    Wait For Process    ${handle}
-
-Terminate all processes
-    ${h1}=    Some process
-    ${h2}=    Some process
-    ${h3}=    Some process
-    ${h4}=    Some process
-    ${h5}=    Some process
-    Sleep    0.1
-    ${p1}=    Get Process Object    ${h1}
-    ${p2}=    Get Process Object    ${h2}
-    ${p3}=    Get Process Object    ${h3}
-    ${p4}=    Get Process Object    ${h4}
-    ${p5}=    Get Process Object    ${h5}
-    :FOR    ${process}    IN    ${p1}    ${p2}    ${p3}    ${p4}    ${p5}
-    \    ${poll}=    Call Method    ${process}    poll
-    \    Should Be Equal    ${poll}    ${NONE}
-    Switch Process    ${h3}
-    Terminate Process    ${h2}
-    Terminate All Processes
-    Sleep    0.1
-    :FOR    ${process}    IN    ${p1}    ${p2}    ${p3}    ${p4}    ${p5}
-    \    ${poll}=    Call Method    ${process}    poll
-    \    Should Not Be Equal    ${poll}    ${NONE}
-
-Terminating all empties cache
-    Some process
-    Terminate All Processes    kill=True
-    ${handle} =    Some Process
-    Should Be Equal    ${handle}    ${1}
-
-*** Keywords ***
-Terminate should stop countdown
-    [Arguments]    ${kill}=false
-    Wait Until Created    ${TEMPFILE}
-    Terminate Process    kill=${kill}
-    ${content1} =    Get File    ${TEMPFILE}
-    Should Not Contain    ${content1}    BLASTOFF
-    Sleep    0.2
-    ${content2} =    Get File    ${TEMPFILE}
-    Should Be Equal    ${content1}    ${content2}
-

==============================================================================
Revision: d32498f829c3
Branch:   default
Author:   Pekka Klärck
Date:     Mon Mar 10 09:24:39 2014 UTC
Log:      Process tests: reuse countdown test script with signal tests
http://code.google.com/p/robotframework/source/detail?r=d32498f829c3

Modified:
 /atest/testdata/standard_libraries/process/resource.txt
 /atest/testdata/standard_libraries/process/sending_signal.txt
 /atest/testdata/standard_libraries/process/terminate_process.txt

=======================================
--- /atest/testdata/standard_libraries/process/resource.txt Thu Mar 6 22:19:35 2014 UTC +++ /atest/testdata/standard_libraries/process/resource.txt Mon Mar 10 09:24:39 2014 UTC
@@ -3,6 +3,8 @@
 Library           OperatingSystem

 *** Variables ***
+${COUNTDOWN}      ${CURDIR}${/}files${/}countdown.py
+${TEMPFILE}       %{TEMPDIR}${/}terminate-process-temp.txt
 ${STDOUT}         %{TEMPDIR}/process-stdout-file.txt
 ${STDERR}         %{TEMPDIR}/process-stderr-file.txt
 ${CWD}            %{TEMPDIR}/process-cwd
@@ -51,9 +53,9 @@
     [Return]    ${path}

 Start Python Process
- [Arguments] ${command} ${alias}=${NONE} ${stdout}=${NONE} ${stderr}=${NONE} + [Arguments] ${command} ${alias}=${NONE} ${stdout}=${NONE} ${stderr}=${NONE} ${shell}=False
     ${handle}=    Start Process    python    -c    ${command}
-    ...    alias=${alias}    stdout=${stdout}    stderr=${stderr}
+ ... alias=${alias} stdout=${stdout} stderr=${stderr} shell=${shell}
     [Return]    ${handle}

 Run Python Process
@@ -77,3 +79,16 @@
     ${ok} =    Evaluate    ${precondition}    modules=sys,os
     Run Keyword If    not ${ok}
... Fail Precondition '${precondition}' was not true. precondition-fail
+
+Wait until countdown started
+    Wait Until Created    ${TEMPFILE}
+
+Countdown should have stopped
+    [Arguments]    ${handle}=${None}
+    ${result}=    Wait For Process    ${handle}
+    Should Not Be Equal    ${result.rc}    ${0}
+    ${content1} =    Get File    ${TEMPFILE}
+    Should Not Contain    ${content1}    BLASTOFF
+    Sleep    0.2
+    ${content2} =    Get File    ${TEMPFILE}
+    Should Be Equal    ${content1}    ${content2}
=======================================
--- /atest/testdata/standard_libraries/process/sending_signal.txt Tue Jan 28 09:20:00 2014 UTC +++ /atest/testdata/standard_libraries/process/sending_signal.txt Mon Mar 10 09:24:39 2014 UTC
@@ -1,5 +1,7 @@
 *** Settings ***
-Test Setup Check Precondition os.sep == "/" and sys.version_info
= (2,6)
+Test Setup        Run Keywords
+... Check Precondition os.sep == "/" and sys.version_info
= (2,6)
+...               AND    Remove File    ${TEMPFILE}
 Suite Teardown    Terminate All Processes
 Resource          resource.txt

@@ -17,11 +19,8 @@
     Killer signal    ${2}

 Send other well-known signals
- :FOR ${signal} IN TERM SIGTERM 15 KILL SIGKILL 9
-    \    Start Sleeping Process
-    \    Send Signal To Process    ${signal}
-    \    ${result} =    Wait For Process
-    \    Should Not Be Equal    ${result.rc}    ${0}
+ :FOR ${signal} IN TERM SIGTERM 15 KILL SIGKILL ${9}
+    \    Killer signal    ${signal}

 Sending an unknown signal
     [Documentation]    FAIL Unsupported signal 'unknown'.
@@ -29,12 +28,12 @@
     Send Signal To Process    unknown

 Sending signal to a process with a handle
-    ${index} =    Start Sleeping Process
-    Start Sleeping Process    alias=alias
+    ${index} =    Start Countdown
+    Start Countdown    alias=alias
     Send Signal To Process    INT    handle=${index}
     Send Signal To Process    INT    alias
-    Sleeping Process Should Have Been Stopped    ${index}
-    Sleeping Process Should Have Been Stopped    alias
+    Countdown Should Have Stopped    ${index}
+    Countdown Should Have Stopped    alias

 Sending signal to a process with a wrong handle
     [Documentation]    FAIL Non-existing index or alias 'unknown'.
@@ -43,23 +42,13 @@
 *** Keywords ***
 Killer signal
     [Arguments]    ${signal}
-    Start Sleeping Process
+    Start Countdown    alias=${signal}
     Send Signal To Process    ${signal}
-    Sleeping Process Should Have Been Stopped
+    Countdown Should Have Stopped    handle=${signal}

-Start Sleeping Process
-    [Arguments]    ${alias}=
-    ${command} =    Catenate    SEPARATOR=\n
-    ...    import time
-    ...    print 'start'
-    ...    for i in range(25): time.sleep(0.1)
-    ...    print 'end'
-    ${index} =    Start Python Process    ${command}    alias=${alias}
-    Sleep    0.1s    Give process time to start
-    [Return]    ${index}
-
-Sleeping Process Should Have Been Stopped
-    [Arguments]    ${handle}=
-    ${result}=    Wait For Process    ${handle}
-    Should Not Be Equal    ${result.rc}    ${0}
-    Should Be Equal    ${result.stdout}    start    handle "${handle}"
+Start Countdown
+    [Arguments]    ${alias}=    ${shell}=False
+    ${handle} =    Start Process    python    ${COUNTDOWN}    ${TEMPFILE}
+    ...    alias=${alias}    shell=${shell}
+    Wait Until Countdown Started
+    [Return]    ${handle}
=======================================
--- /atest/testdata/standard_libraries/process/terminate_process.txt Thu Mar 6 22:21:50 2014 UTC +++ /atest/testdata/standard_libraries/process/terminate_process.txt Mon Mar 10 09:24:39 2014 UTC
@@ -8,8 +8,6 @@

 *** Variables ***
 ${NONTERM}        ${CURDIR}${/}files${/}non_terminable.py
-${COUNTDOWN}      ${CURDIR}${/}files${/}countdown.py
-${TEMPFILE}       %{TEMPDIR}${/}terminate-process-temp.txt

 *** Test Cases ***
 Terminate process
@@ -98,11 +96,6 @@
 *** Keywords ***
 Terminate should stop countdown
     [Arguments]    ${kill}=false
-    Wait Until Created    ${TEMPFILE}
+    Wait until countdown started
     Terminate Process    kill=${kill}
-    ${content1} =    Get File    ${TEMPFILE}
-    Should Not Contain    ${content1}    BLASTOFF
-    Sleep    0.2
-    ${content2} =    Get File    ${TEMPFILE}
-    Should Be Equal    ${content1}    ${content2}
-
+    Countdown should have stopped

==============================================================================
Revision: e687eee65162
Branch:   default
Author:   Pekka Klärck
Date:     Mon Mar 10 09:54:20 2014 UTC
Log:      Process: Cleanup code related to terminating also child processes

Update issue 1675
Little cleanup/fixes to terminating.
http://code.google.com/p/robotframework/source/detail?r=e687eee65162

Modified:
 /src/robot/libraries/Process.py

=======================================
--- /src/robot/libraries/Process.py     Thu Mar  6 20:21:46 2014 UTC
+++ /src/robot/libraries/Process.py     Mon Mar 10 09:54:20 2014 UTC
@@ -489,10 +489,8 @@
         Automatically killing the process if termination fails as well as
returning the result object are new features in Robot Framework 2.8.2.

-        Prior to Robot Framework 2.8.5 only the started process itself, not
- possible child processes started by it, was terminated. This also meant
-        that when `running processes in shell`, only the shell, not the
-        process, was terminated.
+        Starting from Robot Framework 2.8.5, also possible child processes
+        started by the main process are terminated.
         """
         process = self._processes[handle]
         if not hasattr(process, 'terminate'):
@@ -509,10 +507,10 @@

     def _kill(self, process):
         logger.info('Forcefully killing process.')
-        if hasattr(os, 'killpg') and process.pid:
+        if hasattr(os, 'killpg'):
             os.killpg(process.pid, signal_module.SIGKILL)
         else:
-            process.terminate()
+            process.kill()
         if not self._process_is_stopped(process, self.KILL_TIMEOUT):
             raise RuntimeError('Failed to kill process.')

@@ -520,7 +518,7 @@
         logger.info('Gracefully terminating process.')
# Sends signal to the whole process group both on POSIX and on Windows
         # if supported by the interpreter.
-        if hasattr(os, 'killpg') and process.pid:
+        if hasattr(os, 'killpg'):
             os.killpg(process.pid, signal_module.SIGTERM)
         elif hasattr(signal_module, 'CTRL_BREAK_EVENT'):
             if sys.platform == 'cli':

==============================================================================
Revision: 1bdfda9647a0
Branch:   default
Author:   Pekka Klärck
Date:     Mon Mar 10 10:12:37 2014 UTC
Log:      Process: Tuning docs.
http://code.google.com/p/robotframework/source/detail?r=1bdfda9647a0

Modified:
 /src/robot/libraries/Process.py

=======================================
--- /src/robot/libraries/Process.py     Mon Mar 10 09:54:20 2014 UTC
+++ /src/robot/libraries/Process.py     Mon Mar 10 10:12:37 2014 UTC
@@ -472,11 +472,10 @@
         group. If that does not stop the process in 30 seconds, or `kill`
         argument is given a true value, uses Win32 API function
         `TerminateProcess()` to kill the process forcefully. Note that
-        `TerminateProcess()` does not kill possible child processes. Using
- `CTRL_BREAK_EVENT` by default is a new feature in Robot Framework 2.8.5.
+        `TerminateProcess()` does not kill possible child processes.

-        | ${result} =                 | Terminate Process |           |
-        | Should Be Equal As Integers | ${result.rc}      | -15       |
+        | ${result} =                 | Terminate Process |     |
+ | Should Be Equal As Integers | ${result.rc} | -15 | # On Unixes |
         | Terminate Process           | myproc            | kill=true |

         *NOTE:* Stopping processes requires the
@@ -487,10 +486,9 @@
[http://bugs.jython.org/issue1898|do not seem to support them either].

         Automatically killing the process if termination fails as well as
- returning the result object are new features in Robot Framework 2.8.2.
-
-        Starting from Robot Framework 2.8.5, also possible child processes
-        started by the main process are terminated.
+ returning a result object are new features in Robot Framework 2.8.2.
+        Terminating also possible child processes, including using
+        `CTRL_BREAK_EVENT` on Windows, is new in Robot Framework 2.8.5.
         """
         process = self._processes[handle]
         if not hasattr(process, 'terminate'):
@@ -554,8 +552,8 @@
         If `handle` is not given, uses the current `active process`.

         Signal can be specified either as an integer, or anything that can
-        be converted to an integer, or as a name. In the latter case it is
-        possible to give the name both with or without a `SIG` prefix,
+ be converted to an integer, or as a signal name. In the latter case it
+        is possible to give the name both with or without a `SIG` prefix,
         but names are case-sensitive. For example, all the examples below
         send signal `INT (2)`:

@@ -568,7 +566,7 @@
         signal handling (typically `man signal` or `man 7 signal`).

         If you are stopping a process, it is often easier and safer to use
-        `Terminate Process` instead.
+        `Terminate Process` keyword instead.

         *NOTE:* Sending signals requires the
         [http://docs.python.org/2/library/subprocess.html|subprocess]

==============================================================================
Revision: 4765c1acdd4c
Branch:   default
Author:   Pekka Klärck
Date:     Mon Mar 10 10:21:34 2014 UTC
Log:      Process: Add support for sending signals to whole process group

Update issue 1675
Added new `group` argument to Send Signal To Process to allow sending signals to the whole process group. Still sends the signal only to the parent by default.
http://code.google.com/p/robotframework/source/detail?r=4765c1acdd4c

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

=======================================
--- /atest/robot/standard_libraries/process/sending_signal.txt Wed Mar 5 17:55:29 2014 UTC +++ /atest/robot/standard_libraries/process/sending_signal.txt Mon Mar 10 10:21:34 2014 UTC
@@ -23,6 +23,18 @@

 Send other well-known signals
     Check Test Case    ${TESTNAME}
+
+By default signal is not sent to process running in shell
+    Check Test Case    ${TESTNAME}
+
+By default signal is sent only to parent process
+    Check Test Case    ${TESTNAME}
+
+Signal can be sent to process running in shell
+    Check Test Case    ${TESTNAME}
+
+Signal can be sent to child processes
+    Check Test Case    ${TESTNAME}

 Sending an unknown signal
     Check Test Case    ${TESTNAME}
=======================================
--- /atest/testdata/standard_libraries/process/resource.txt Mon Mar 10 09:24:39 2014 UTC +++ /atest/testdata/standard_libraries/process/resource.txt Mon Mar 10 10:21:34 2014 UTC
@@ -92,3 +92,13 @@
     Sleep    0.2
     ${content2} =    Get File    ${TEMPFILE}
     Should Be Equal    ${content1}    ${content2}
+
+Countdown should not have stopped
+    [Arguments]    ${handle}=${None}
+    ${result}=    Wait For Process    ${handle}
+    Should Not Be Equal    ${result.rc}    ${0}
+    ${content1} =    Get File    ${TEMPFILE}
+    Should Not Contain    ${content1}    BLASTOFF
+    Sleep    0.2
+    ${content2} =    Get File    ${TEMPFILE}
+    Should Not Be Equal    ${content1}    ${content2}
=======================================
--- /atest/testdata/standard_libraries/process/sending_signal.txt Mon Mar 10 09:24:39 2014 UTC +++ /atest/testdata/standard_libraries/process/sending_signal.txt Mon Mar 10 10:21:34 2014 UTC
@@ -21,6 +21,22 @@
 Send other well-known signals
:FOR ${signal} IN TERM SIGTERM 15 KILL SIGKILL ${9}
     \    Killer signal    ${signal}
+
+By default signal is not sent to process running in shell
+    Start Countdown    shell=yes
+    Send Signal To Process    TERM
+    Countdown should not have stopped
+
+By default signal is sent only to parent process
+    Start Countdown    children=3
+    Send Signal To Process    SIGTERM
+    Countdown should not have stopped
+
+Signal can be sent to process running in shell
+    Killer signal    TERM    shell=True    group=yes
+
+Signal can be sent to child processes
+    Killer signal    TERM    children=3    group=${True}

 Sending an unknown signal
     [Documentation]    FAIL Unsupported signal 'unknown'.
@@ -41,14 +57,14 @@

 *** Keywords ***
 Killer signal
-    [Arguments]    ${signal}
-    Start Countdown    alias=${signal}
-    Send Signal To Process    ${signal}
+ [Arguments] ${signal} ${shell}=False ${children}=0 ${group}=False + Start Countdown alias=${signal} shell=${shell} children=${children}
+    Send Signal To Process    ${signal}    group=${group}
     Countdown Should Have Stopped    handle=${signal}

 Start Countdown
-    [Arguments]    ${alias}=    ${shell}=False
+    [Arguments]    ${alias}=    ${shell}=False    ${children}=0
     ${handle} =    Start Process    python    ${COUNTDOWN}    ${TEMPFILE}
-    ...    alias=${alias}    shell=${shell}
+    ...    ${children}    alias=${alias}    shell=${shell}
     Wait Until Countdown Started
     [Return]    ${handle}
=======================================
--- /src/robot/libraries/Process.py     Mon Mar 10 10:12:37 2014 UTC
+++ /src/robot/libraries/Process.py     Mon Mar 10 10:21:34 2014 UTC
@@ -546,7 +546,7 @@
                 self.terminate_process(handle, kill=kill)
         self.__init__()

-    def send_signal_to_process(self, signal, handle=None):
+    def send_signal_to_process(self, signal, handle=None, group=False):
         """Sends the given `signal` to the specified process.

         If `handle` is not given, uses the current `active process`.
@@ -565,6 +565,14 @@
         existing signals on your system, see the Unix man pages related to
         signal handling (typically `man signal` or `man 7 signal`).

+ By default sends the signal only to the parent process, not to possible + child processes started by it. Notice that when `running processes in
+        shell`, the shell is the parent process and thus the actual started
+ process does not receive the signal. To send the signal to the whole
+        process group, `group` argument can be set to any true value:
+
+        | Send Signal To Process | TERM  | group=yes |
+
         If you are stopping a process, it is often easier and safer to use
         `Terminate Process` keyword instead.

@@ -574,17 +582,21 @@
         in Python 2.6 and are thus missing from earlier versions.
         How well it will work with forthcoming Jython 2.7 is unknown.

-        New in Robot Framework 2.8.2.
+        New in Robot Framework 2.8.2. Support for `group` argument is new
+        in Robot Framework 2.8.5.
         """
         if os.sep == '\\':
             raise RuntimeError('This keyword does not work on Windows.')
         process = self._processes[handle]
-        if not hasattr(process, 'send_signal'):
+        signum = self._get_signal_number(signal)
+        logger.info('Sending signal %s (%d).' % (signal, signum))
+        if is_true(group) and hasattr(os, 'killpg'):
+            os.killpg(process.pid, signum)
+        elif hasattr(process, 'send_signal'):
+            process.send_signal(signum)
+        else:
             raise RuntimeError('Sending signals is not supported '
                                'by this Python version.')
-        signum = self._get_signal_number(signal)
-        logger.info('Sending signal %s (%d).' % (signal, signum))
-        process.send_signal(signum)

     def _get_signal_number(self, int_or_name):
         try:

--

--- 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to