Fix for hub/test_passfd.py to allow it to run under Python 3.x; tested ok
on Python 2.7. Ran across this while trying to understand a potential
problem with passfd.c (I run FreeBSD) in conjunction with Python 3.2 that
I've not noticed before. Still haven't isolated the issue and it may lie
elsewhere.
Meanwhile:
$ hg diff test_passfd.py
diff -r a4b242b7587d hub/test_passfd.py
--- a/hub/test_passfd.py Mon Mar 28 16:38:14 2011 -0700
+++ b/hub/test_passfd.py Tue Mar 29 00:07:06 2011 -0700
@@ -7,6 +7,7 @@
import os, sys, socket
from qp.hub import passfd
+
#
# Create a pipe for sending the fd.
#
@@ -28,7 +29,8 @@
fd = fileObj.fileno()
# Send to the child
- os.write(wfd, "x")
+ msg = 'x'.encode('utf-8') # Python3.x requires the equivalent of
os.write(wfd, b'x')
+ os.write(wfd, msg)
passfd.sendfd(wfd, fd)
# Wait for child to terminate, then exit.