[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: popen problem with command line interpreter
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sat, 27 Feb 2010 09:34:49 -0300
> It appears that the command line Lua interpreter does not trap SIGPIPE:
It does not. lua.c is mostly an ANSI C program. It'd have to be a POSIX
program to 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 $?
I get this in Linux:
> f = assert(io.popen("true", "w"))
> =f:write "Hello, world."
> I'm not sure how the situation could be improved much.
I don't think it can be improved at all if f:write returns true. Of course,
f:write probably just buffers the output because if I replace f:close with
f:flush I get the same error (Broken pipe).