I wrote a twitter like service, and I want to do some stress testing on it with python.
I have a client program, called “client”.
I want to write a script that will start several processes of the the “client” program, send a few messages, wait a few seconds and will exit.
what I wrote is
p = subprocess.Popen(['client','c1','localhost','4981'],stdin=subprocess.PIPE)
now I can’t call the communicate method, because it waits for an EOF but the process isn’t over yet.
calling the stdin.flush doesn’t seems to work either.
Any tips on how do I do this?
(I don’t have to do this in python, if theres a way to do this with a bash script its also ok)
You can use bash loop to run some clients and put them into the background. If you need to communicate with one, just put it to the foreground using fg and then put it to background again using bg