From a4c5bd399cd24e89f8b41c76c8d0b5c663649aee Mon Sep 17 00:00:00 2001 From: ccremers Date: Sun, 6 Aug 2006 15:29:57 +0000 Subject: [PATCH] - Probably fixed buffering problem using stdout stuff. --- gui/Scytherthread.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/gui/Scytherthread.py b/gui/Scytherthread.py index bdfeb9a..d22230f 100644 --- a/gui/Scytherthread.py +++ b/gui/Scytherthread.py @@ -112,13 +112,26 @@ class AttackThread(threading.Thread): type = "png" ext = ".png" + # command to write to temporary file (fd2,fpname2) = Tempfile.tempcleaned(ext) - pw,pr = os.popen2("dot -T%s -o%s" % (type,fpname2)) - pw.write(attack.scytherDot) - pw.close() - pr.close() - attack.file = fpname2 # this is where the file name is stored + f = os.fdopen(fd2,'w') + cmd = "dot -T%s" % (type) + + # execute command + cin,cout = os.popen2(cmd) + cin.write(attack.scytherDot) + cin.close() + + for l in cout.read(): + f.write(l) + + cout.close() + f.flush() + f.close() + + # if this is done, store and report attack.filetype = type + attack.file = fpname2 # this is where the file name is stored #---------------------------------------------------------------------------