0
我想有作为运行我的测试框架内的独立进程web服务器:运行一台服务器作为一个独立的过程 - 的Python
from subprocess import Popen, PIPE, STDOUT
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
server_cmd = "bundle exec thin start -p 3001 --ssl" # rails comamnd
# intend to start the server as a standalone process
webserver = Popen(server_cmd, shell=True, stdin=PIPE, stdout=PIPE,
stderr=PIPE, close_fds=True)
的服务器工作出很好的话,我执行一些任务Selenium
。在第一时间,这些任务执行很好:
curl -v https://localhost:3001 -k
* Rebuilt URL to: https://localhost:3001/
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 3001 (#0)
* TLS 1.0 connection using TLS_RSA_WITH_AES_256_CBC_SHA
* Server certificate: openca.steamheat.net
> GET/HTTP/1.1
> Host: localhost:3001
> User-Agent: curl/7.43.0
> Accept: */*
然而,一旦任务是重复的,Web服务器停止运行:
curl -v https://localhost:3001 -k -L
* Rebuilt URL to: https://localhost:3001/
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 3001 (#0)
* Closing connection 0
当我执行,在一个shell
终端相同的命令,这两个任务完成如所假设的。 我想知道是否与stdout
的输出量有关,因为Rails
服务器向终端输出大量信息。 我该如何解决这个问题?网络服务器停止运行的原因是什么?