[Twisted-Python] Solaris t.i.process.py patch.

Skinny Puppy skin_pup-twisted at damnable.happypoo.com
Fri Feb 7 16:01:28 EST 2003


On Solaris for some reason whenever I ran my app in the background it
would fail (as seen in the attached log, twisted -f poo.tap).  But the 
really weird thing was when I ran it in the foreground (twisted -n -f
poo.tap) it did not return this error.  I have created a patch that 
fixes the problem does not really solve it.  I will be checking into 
this some more,  and what is wrong with Solaris :)

Jeremy 

-------------- next part --------------
Index: twisted/internet/process.py
===================================================================
RCS file: /cvs/Twisted/twisted/internet/process.py,v
retrieving revision 1.46
diff -u -r1.46 process.py
--- twisted/internet/process.py	6 Jan 2003 05:56:46 -0000	1.46
+++ twisted/internet/process.py	7 Feb 2003 20:50:54 -0000
@@ -242,9 +242,13 @@
                              (command, str(args),
                               "id %s" % id(environment)))
                 traceback.print_exc(file=stderr)
-                stderr.flush()
-                for fd in range(3):
-                    os.close(fd)
+                # XXX This is to deal with Solaris. 
+                try:
+                    stderr.flush()
+                    for fd in range(3):
+                        os.close(fd)   
+                except IOError:
+                    pass       
             os._exit(1)
         if settingUID:
             os.setregid(currgid, curegid)
@@ -485,7 +489,11 @@
                              (command, str(args),
                               "id %s" % id(environment)))
                 traceback.print_exc(file=stderr)
-                stderr.flush()
+                # XXX More to deal with solaris
+                try:
+                    stderr.flush()
+                except IOError:
+                    pass
             os._exit(1)
         assert pid!=0
         os.close(slavefd)
-------------- next part --------------
06/02/2003 14:51 [MasterLDAPClient,client]   File "/usr/local/lib/python2.2/site-packages/twisted/internet/defer.py", line 213, i
n _startRunCallbacks
06/02/2003 14:51 [MasterLDAPClient,client]     self._runCallbacks()
06/02/2003 14:51 [MasterLDAPClient,client]   File "/usr/local/lib/python2.2/site-packages/twisted/internet/defer.py", line 227, i
n _runCallbacks
06/02/2003 14:51 [MasterLDAPClient,client]     (self.result,)+tuple(args), kw)
06/02/2003 14:51 [MasterLDAPClient,client]   File "/usr/local/lib/python2.2/site-packages/twisted/internet/defer.py", line 162, i
n callback
06/02/2003 14:51 [MasterLDAPClient,client]     self._startRunCallbacks(result, 0)
06/02/2003 14:51 [MasterLDAPClient,client]   File "/usr/local/lib/python2.2/site-packages/twisted/internet/defer.py", line 213, i
n _startRunCallbacks
06/02/2003 14:51 [MasterLDAPClient,client]     self._runCallbacks()
06/02/2003 14:51 [MasterLDAPClient,client] --- <exception caught here> ---
06/02/2003 14:51 [MasterLDAPClient,client]   File "/usr/local/lib/python2.2/site-packages/twisted/internet/defer.py", line 227, i
n _runCallbacks
06/02/2003 14:51 [MasterLDAPClient,client]     (self.result,)+tuple(args), kw)
06/02/2003 14:51 [MasterLDAPClient,client]   File "/usr/local/lib/python2.2/site-packages/ldap2system/sudoers.py", line 601, in s
torage
06/02/2003 14:51 [MasterLDAPClient,client]     sudoersWrite(d, self.client.factory.searchs[i].storage)
06/02/2003 14:51 [MasterLDAPClient,client]   File "/usr/local/lib/python2.2/site-packages/ldap2system/sudoers.py", line 526, in _
_init__
06/02/2003 14:51 [MasterLDAPClient,client]     self.write()
06/02/2003 14:51 [MasterLDAPClient,client]   File "/usr/local/lib/python2.2/site-packages/ldap2system/sudoers.py", line 533, in w
rite
06/02/2003 14:51 [MasterLDAPClient,client]     d = ProtocolWithDeferred(checkfile, visudo, ['-c', '-f', self.obj.filename + ".tmp
"], {})
06/02/2003 14:51 [MasterLDAPClient,client]   File "/usr/local/lib/python2.2/site-packages/ldap2system/sudoers.py", line 518, in P
rotocolWithDeferred
06/02/2003 14:51 [MasterLDAPClient,client]     reactor.spawnProcess(p, executable, (executable,)+tuple(args), env, path)
06/02/2003 14:51 [MasterLDAPClient,client]   File "/usr/local/lib/python2.2/site-packages/twisted/internet/default.py", line 274,
 in spawnProcess
06/02/2003 14:51 [MasterLDAPClient,client]     return process.Process(self, executable, args, env, path, processProtocol, uid, gi
d)
06/02/2003 14:51 [MasterLDAPClient,client]   File "/usr/local/lib/python2.2/site-packages/twisted/internet/process.py", line 245,
 in __init__
06/02/2003 14:51 [MasterLDAPClient,client]     stderr.flush()
06/02/2003 14:51 [MasterLDAPClient,client] exceptions.IOError: [Errno 9] Bad file number



More information about the Twisted-Python mailing list