Update of /cvsroot/monetdb/sql/src/test/Dump/Tests
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv25042/src/test/Dump/Tests

Modified Files:
      Tag: Nov2009
        reload.SQL.py 
Log Message:
propagated changes of Wednesday Oct 14 2009
from the Aug2009 branch to the Nov2009 branch

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2009/10/14 - sjoerd: src/test/Dump/Tests/reload.SQL.py,1.5.6.1
  Avoid potential deadlock.  If you have pipes into and out of a
  process, don't write large amounts of data to the process without
  checking its output.  Using the communicate method, that happens
  automatically.
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Index: reload.SQL.py
===================================================================
RCS file: /cvsroot/monetdb/sql/src/test/Dump/Tests/reload.SQL.py,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -u -d -r1.6.2.1 -r1.6.2.2
--- reload.SQL.py       12 Oct 2009 15:36:22 -0000      1.6.2.1
+++ reload.SQL.py       14 Oct 2009 08:22:38 -0000      1.6.2.2
@@ -8,14 +8,12 @@
 
     cmd = str('%s -umonetdb -Pmonetdb -p %s' % (SQLCLIENT, MAPIPORT))
     f = open(os.path.join(TSTTRGDIR, 'dumpoutput.sql'), 'r')
-    clt = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, 
stdin=subprocess.PIPE, stderr=subprocess.PIPE)
-    clt.stdin.write(f.read())
-    clt.stdin.close()
+    clt = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
+                           stdin=subprocess.PIPE, stderr=subprocess.PIPE)
+    out, err = clt.communicate(f.read())
     f.close()
-    sys.stdout.write(clt.stdout.read())
-    clt.stdout.close()
-    sys.stderr.write(clt.stderr.read())
-    clt.stderr.close()
+    sys.stdout.write(out)
+    sys.stderr.write(err)
 
 
 main()


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to