Browse Source

- childutils.eventdata was buggy, it could not deal with carriage returns
in data. See http://www.plope.com/software/collector/257. Thanks
to Ian Bicking.

Chris McDonough 17 years ago
parent
commit
0f4c6412dc
3 changed files with 8 additions and 4 deletions
  1. 4 0
      CHANGES.txt
  2. 1 1
      src/supervisor/childutils.py
  3. 3 3
      src/supervisor/tests/test_childutils.py

+ 4 - 0
CHANGES.txt

@@ -1,5 +1,9 @@
 Next Release
 
+  - childutils.eventdata was buggy, it could not deal with carriage returns
+    in data.  See http://www.plope.com/software/collector/257.  Thanks
+    to Ian Bicking.
+
   - Per-process exitcodes= configuration now will not accept exit
     codes that are integers above 255 (supervisord will not start when
     one of the exit codes is outside the range of 0 - 255).

+ 1 - 1
src/supervisor/childutils.py

@@ -34,7 +34,7 @@ def get_headers(line):
     return dict([ x.split(':') for x in line.split() ])
 
 def eventdata(payload):
-    headerinfo, data = payload.split('\n')
+    headerinfo, data = payload.split('\n', 1)
     headers = get_headers(headerinfo)
     return headers, data
 

+ 3 - 3
src/supervisor/tests/test_childutils.py

@@ -33,11 +33,11 @@ class ChildUtilsTests(unittest.TestCase):
 
     def test_eventdata(self):
         from supervisor.childutils import eventdata
-        payload = 'a:1 b:2\nthedata'
+        payload = 'a:1 b:2\nthedata\n'
         headers, data = eventdata(payload)
         self.assertEqual(headers, {'a':'1', 'b':'2'})
-        self.assertEqual(data, 'thedata')
-        
+        self.assertEqual(data, 'thedata\n')
+
 class TestProcessCommunicationsProtocol(unittest.TestCase):
     def test_send(self):
         from supervisor.childutils import pcomm