On 18/03/2016 14:25, Rob Arthan wrote:
On 18 Mar 2016, at 13:13, David Matthews <David.Matthews at prolingua.co.uk> wrote:
On 18/03/2016 02:40, Michael Norrish wrote:
Under 5.5.1, and after compiling with polyc, the code below gives an assertion violation and core dump:
This was a bug that has been fixed in the current version, 5.6.
Exceptions are raised in the run-time system when it detects errors such as invalid parameters. Assertions are used for errors in the run-time system itself. The idea is to be slightly more helpful than just a segfault with no other information.
I tried Michael?s example on 5.6. It didn?t raise an exception, but it also didn?t terminate: it hangs in the call to TextIO.inputLine in the parent process, so I think there is something else wrong (as the call is reading from a pipe whose writer has exited, so I'd expect it to return NONE).
The problem is that the output side of the pipe has not been closed in the parent. That means that both sides of the pipe are open in the parent so the input side doesn't see end-of-stream. Adding "close outfd" in the "SOME pid" branch fixes this.
David