You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have observed under some conditions, Cabal will interleave stderr and stdout:
-----BEGIN CABAL OUTPUT-----
Downloading old-time-1.1.0.3...
[-Extracting /srv/code/haskell-pushbot/cabal-binaries/cabal-testsuite/PackageTests/NewBuild/T4375/cabal.dist/home/.cabal/packages/test-local-repo/old-locale/1.0.0.7/old-locale-1.0.0.7.tar.gz to /srv/code/haskell-pushbot/cabal-binaries/cabal-testsuite/PackageTests/NewBuild/T4375/cabal.dist/work/./dist/tmp/src-28346...-]
-----END CABAL OUTPUT-----
[-Updating old-locale.cabal with the latest revision from the index.-]
writing /srv/code/haskell-pushbot/cabal-binaries/cabal-testsuite/PackageTests/NewBuild/T4375/cabal.dist/home/.cabal/packages/test-local-repo/old-time/1.1.0.3/old-time-1.1.0.3.tar.gz
{+Extracting /srv/code/haskell-pushbot/cabal-binaries/cabal-testsuite/PackageTests/NewBuild/T4375/cabal.dist/home/.cabal/packages/test-local-repo/old-locale/1.0.0.7/old-locale-1.0.0.7.tar.gz to /srv/code/haskell-pushbot/cabal-binaries/cabal-testsuite/PackageTests/NewBuild/T4375/cabal.dist/work/./dist/tmp/src-28736...+}
{+Updating old-locale.cabal with the latest revision from the index.+}
creating dist
(in this case, the Downloading message is occurring in a separate thread onto stdout, while "Extracting..." is stderr). This is bad juju. Probably the correct way to fix this is to prefix the markers on every line so we never get confused, but then we have to make sure stderr doesn't get interleaved within a single line this way.
If I read the hPutStr source correctly, this happens because in LineBuffering mode it acquires and releases the handle lock for each line it outputs. E.g. if you run hPutStr h "foo\nbar\n", it will acquire the lock, output "foo", then release and reacquire it, output "bar", and then release the lock again. So a simple way to work around this issue would probably be to use block buffering and flush the handle afterwards, or just prefix the marker on every line as the OP suggests.
I have observed under some conditions, Cabal will interleave stderr and stdout:
(in this case, the Downloading message is occurring in a separate thread onto stdout, while "Extracting..." is stderr). This is bad juju. Probably the correct way to fix this is to prefix the markers on every line so we never get confused, but then we have to make sure stderr doesn't get interleaved within a single line this way.
Related: #4357
The text was updated successfully, but these errors were encountered: