Last active
August 26, 2015 08:10
-
-
Save larsw/235e4a35c1470e575eee to your computer and use it in GitHub Desktop.
Unexpected sequence of output on Linux/F# 3.1/Mono 3.12.0 (expected "foo" to be output after the numerical sequence)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let seqGen a b = | |
seq { | |
yield! seq { a .. b } | |
raise (System.UnauthorizedAccessException("foo")) | |
} | |
try | |
seqGen 1 10 | |
|> Seq.iter (fun x -> printf "%A " x) | |
with | |
| :? System.UnauthorizedAccessException as uae -> eprintfn "%A" uae.Message; exit -1 | |
exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# F# 3.1 / mono 3.12.0 / Ubuntu Linux 15.04 | |
"foo" | |
1 2 3 4 5 6 7 8 9 10 | |
[Finished in 3.045s] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# F# 3.1 / .NET 4.5.x / Windows 7 | |
1 2 3 4 5 6 7 8 9 10 | |
"foo" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With s/eprintfn/printfn/ on line 11, the output is ordered as expected.
Seems like processing of stderr has higher precedence than stdout in the terminal subsystem in Linux.