[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: popen problem with command line interpreter
- From: Rob Kendrick <rjek@...>
- Date: Fri, 26 Feb 2010 14:21:46 +0000
Hi,
It appears that the command line Lua interpreter does not trap SIGPIPE:
rjek@trite:~$ lua
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> f = assert(io.popen("true", "w"))
> f:write "Hello, world."
> f:close()
rjek@trite:~$ echo $?
141
strace suggests it's trying to flush data to a pipe for which there is
nothing connected to at the other end (because 'true' exits straight
away.)
I'm not sure how the situation could be improved much. In the ideal
world, it would be nice for write or close to return some sort of error
condition when this occurs, but I can't quite see how to do this
cleanly.
Perhaps simply an error message before the interpreter vanishes?
B.