Updated image construction code to also use subprocess.Popen.
This commit is contained in:
parent
1f75f73cb0
commit
d1b334765b
@ -25,10 +25,12 @@
|
|||||||
import wx
|
import wx
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from subprocess import Popen, PIPE
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
""" Import scyther components """
|
""" Import scyther components """
|
||||||
|
from Scyther import Misc as MiscScyther
|
||||||
|
|
||||||
""" Import scyther-gui components """
|
""" Import scyther-gui components """
|
||||||
import Temporary
|
import Temporary
|
||||||
@ -126,22 +128,23 @@ def makeImageDot(dotdata,attackthread=None):
|
|||||||
(fd2,fpname2) = Temporary.tempcleaned(ext)
|
(fd2,fpname2) = Temporary.tempcleaned(ext)
|
||||||
f = os.fdopen(fd2,'w')
|
f = os.fdopen(fd2,'w')
|
||||||
|
|
||||||
|
# Set up command
|
||||||
cmd = "dot -T%s" % (type)
|
cmd = "dot -T%s" % (type)
|
||||||
|
|
||||||
# execute command
|
# execute command
|
||||||
cin,cout = os.popen2(cmd,'b')
|
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE)
|
||||||
|
|
||||||
if attackthread:
|
if attackthread:
|
||||||
writeGraph(attackthread,dotdata,cin)
|
writeGraph(attackthread,dotdata,p.stdin)
|
||||||
else:
|
else:
|
||||||
cin.write(dotdata)
|
p.stdin.write(dotdata)
|
||||||
|
|
||||||
cin.close()
|
p.stdin.close()
|
||||||
|
|
||||||
for l in cout.read():
|
for l in p.stdout.read():
|
||||||
f.write(l)
|
f.write(l)
|
||||||
|
|
||||||
cout.close()
|
p.stdout.close()
|
||||||
f.flush()
|
f.flush()
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
""" Import externals """
|
""" Import externals """
|
||||||
import os.path
|
import os.path
|
||||||
|
from subprocess import Popen,PIPE
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -70,7 +71,9 @@ def cmdpushwrite(cmd,data,fname):
|
|||||||
"""
|
"""
|
||||||
fp = open(fname,'w')
|
fp = open(fname,'w')
|
||||||
# execute command
|
# execute command
|
||||||
cin,cout = os.popen2(cmd,'b')
|
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE)
|
||||||
|
(cin,cout) = (p.stdin, p.stdout)
|
||||||
|
|
||||||
cin.write(data)
|
cin.write(data)
|
||||||
cin.close()
|
cin.close()
|
||||||
for l in cout.read():
|
for l in cout.read():
|
||||||
|
Loading…
Reference in New Issue
Block a user