-LRN: Make gnunet_testing.py W32-compatible
authorChristian Grothoff <christian@grothoff.org>
Sun, 11 Mar 2012 07:25:04 +0000 (07:25 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 11 Mar 2012 07:25:04 +0000 (07:25 +0000)
src/integration-tests/gnunet_testing.py.in

index 79cbfe9a2dfe53dddb287abd02271b0ed234e6ef..f8b8ff31d22e8213cebba6c0aba1318089e53635 100644 (file)
@@ -224,7 +224,11 @@ class Peer:
         server.spawn (None, [self.test.gnunetstatistics, '-c', self.cfg ,'-q','-n', name, '-s', subsystem ], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
         #server.expect ("stdout", re.compile (r""))
         test = server.read("stdout", 10240)
-        tests = test.partition('\n')[0]
+        tests = test.partition('\n')
+        # On W32 GNUnet outputs with \r\n, rather than \n
+        if os.name == 'nt' and tests[1] == '\n' and tests[0][-1] == '\r':
+            tests = (tests[0][:-1], tests[1], tests[2])
+        tests = tests[0]
         if (tests.isdigit() == True):
             return tests
         else: