diff rgedgeR/rgToolFactory.py @ 19:372ce0323554 draft

Uploaded
author fubar
date Sat, 27 Jul 2013 20:55:31 -0400
parents cd586457aced
children 42c28d9fc836
line wrap: on
line diff
--- a/rgedgeR/rgToolFactory.py	Sat Jul 27 20:46:47 2013 -0400
+++ b/rgedgeR/rgToolFactory.py	Sat Jul 27 20:55:31 2013 -0400
@@ -132,7 +132,8 @@
         tscript.close()
         self.indentedScript = '\n'.join([' %s' % x for x in s]) # for restructured text in help
         self.escapedScript = '\n'.join([html_escape(x) for x in s])
-        if opts.output_dir: # may not want these complexities 
+        self.elog = os.path.join(self.opts.output_dir,"%s_error.log" % self.toolname)
+            if opts.output_dir: # may not want these complexities 
             self.tlog = os.path.join(self.opts.output_dir,"%s_runner.log" % self.toolname)
             art = '%s.%s' % (self.toolname,opts.interpreter)
             artpath = os.path.join(self.opts.output_dir,art) # need full path
@@ -515,10 +516,11 @@
           retval = self.runBash()
         else:
             if self.opts.output_dir:
+                ste = open(self.elog,'w')
                 sto = open(self.tlog,'w')
                 sto.write('## Toolfactory generated command line = %s\n' % ' '.join(self.cl))
                 sto.flush()
-                p = subprocess.Popen(self.cl,shell=False,stdout=sto,stderr=sto,stdin=subprocess.PIPE,cwd=self.opts.output_dir)
+                p = subprocess.Popen(self.cl,shell=False,stdout=sto,stderr=elog,stdin=subprocess.PIPE,cwd=self.opts.output_dir)
             else:
                 p = subprocess.Popen(self.cl,shell=False,stdin=subprocess.PIPE)
             p.stdin.write(self.script)
@@ -526,6 +528,10 @@
             retval = p.wait()
             if self.opts.output_dir:
                 sto.close()
+                ste.close()
+                err = open(self.elog,'r').readlines()
+                if retval <> 0 and err: # problem
+                    print >> sys.stderr,err
             if self.opts.make_HTML:
                 self.makeHtml()
         return retval