[ create a new paste ] login | about

Link: http://codepad.org/ArYdEc3s    [ raw code | fork ]

Perseids - Python, pasted on Jun 20:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 def readAvailableData(pollObj, scipOut):
     scipOutput = ""
     pollReturn = pollObj.poll(1)
     while len(pollReturn)>0:
         assert len(pollReturn)==1
         assert pollObj.poll(1)[0][1]==select.POLLIN
         scipOutput += scipOut.read(1)
         sys.stdout.write(scipOutput[-1])
         pollReturn = pollObj.poll(1)
 
     return scipOutput

 process = subprocess.Popen(["scip"],shell=True,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE, cwd=workingDir)
 scipIn =  process.stdin
 scipOut = process.stdout
 scipErr = process.stderr

 pollObj = select.poll()
 pollObj.register(scipOut)

 scipOutput = readUntilPrompt(pollObj, scipOut)


Create a new paste based on this one


Comments: