Commands started by logtoprocess are running asynchronously. To be able to
test the output, we need to block and wait for the output.
The patch uses "| cat" to wait for such "asynchronous" outputs, to make the
test more reliable. I have also written a short notice at the top, hopefully
people would be aware of the pitfall when changing the test.
diff --git a/tests/test-logtoprocess.t b/tests/test-logtoprocess.t
@@ -1,2 +1,6 @@
+ATTENTION: logtoprocess runs commands asynchronously. Be sure to append "| cat"
+to hg commands, to wait for the output, if you want to test its output.
+Otherwise the test will be flaky.
Test if logtoprocess correctly captures command-related log calls.
@@ -35,7 +39,6 @@ Running a command triggers both a ui.log
ui.log('commandfinish') call. The foo command also uses ui.log.
-Use head to ensure we wait for all lines to be produced, and sort to avoid
-ordering issues between the various processes we spawn:
- $ hg foo | head -n 17 | sort
+Use sort to avoid ordering issues between the various processes we spawn:
+ $ hg foo | cat | sort
@@ -67,4 +70,4 @@ Confirm that logging blocked time catche