robotframework: Process library Wait For Process keyword does not return when used with some adb commands
Ugh
I am using Robot Framework 2.8.7 (Python 2.7.6 on win32), on Windows 7 (64bit).
When I do this:
*** Settings ***
Library Process
*** Test Cases ***
Example
${handle} = Process.Start Process
... adb
... status-window
... shell=yes
... cwd=${OUTPUT_DIR}
${result}= Process.Wait For Process
... handle=${handle}
... on_timeout=kill
... timeout=15 s
Then the Wait For Process keyword hangs forever. I see this in the debug log (note removed the tilde characters from the log file keyword boundary because github did some fancy formatting):
==============================================================================
20150804 10:49:34.472 - INFO - + START SUITE: Example [ ]
==============================================================================
20150804 10:49:34.473 - INFO - +- START TEST: Example [ ]
------------------------------------------------------------------------------
20150804 10:49:34.474 - INFO - +-- START KW: ${handle} = Process.Start Process [ adb | status-window | shell=yes | cwd=${OUTPUT_DIR} ]
20150804 10:49:34.474 - INFO - Starting process:
adb status-window
20150804 10:49:34.475 - DEBUG - Process configuration:
cwd = C:\workspace\system-test\tests
stdout_stream = -1
stderr_stream = -1
shell = True
alias = None
env = None
20150804 10:49:34.483 - INFO - ${handle} = 1
20150804 10:49:34.484 - INFO - +-- END KW: ${handle} = Process.Start Process (9)
20150804 10:49:34.485 - INFO - +-- START KW: ${result} = Process.Wait For Process [ handle=${handle} | on_timeout=kill | timeout=15 s ]
20150804 10:49:34.485 - INFO - Waiting for process to complete.
20150804 10:49:49.534 - INFO - Process did not complete in 15 seconds.
20150804 10:49:49.535 - INFO - Forcefully killing process.
The adb process is not killed and to recover I have manually kill the adb process. I did expect the adb process be killed after 15 and keyword not to hang forever.
Adb is part of the Android SDK: http://developer.android.com/tools/adk/index.html
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 31 (27 by maintainers)
Sounds like process output streams would get full which causes the process to hang. You can try emulating how Start Process configures stdout/stderr by default on pure Python by setting
stdout=subprocess.PIPEandstderr=subprocess.PIPE.Process library docs mention that stdout/stderr can get full unless directed to files. Perhaps that note should be made more visible.