lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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.