I have no idea, os.execute did give me some problems in the past,
can't remember what though.
One thought is that when you popen this way you can't close the file
when it's done, i'm not sure what's the implications though, maybe try
breaking it into:
fh=io.popen(...)
txt=fh:read("*a")
fh:close()

one thing to think about though is that awesome (or lua?) is single
threaded, so while your popen is running awesome will hang.
I know that's not much help, let me know how it goes
Yussi


On Sat, Oct 2, 2010 at 10:20 PM, David Unric <[email protected]> wrote:
> I did investigated the issue a bit further and figured out it has also
> nothing to do with file streams for stdin, stdout and stderr.
> Following simple code placed in rc.lua configuration script hangs its
> execution forever:
>
> os.execute('xrandr -q')    -- hangs in rc.lua, does work anywhere else
>
> Any idea why ??
> xrandr process can be normally seen by ps output and rc.lua does not
> continua and waits for something ...
>
> Thx for any advice
>
> David
>
> On Sat, Oct 2, 2010 at 1:41 AM, David Unric <[email protected]> wrote:
>>
>> Hello,
>>
>> it starts to drive me a bit mad because I cann't understand what's going
>> wrong with the following code:
>>
>> prg_out = io.popen('/usr/bin/xkb-switch'):read('*a')
>>
>> When run in a separate script or from Lua interpreter it works as
>> expected, ie. it stores program output in prg_out variable. But run from
>> rc.lua it hangs forever. Function io.popen() successfully returns file
>> handle but any attempt to call read() or close() at this handle results in
>> script stall :(
>> The same behavior when trying to catch output of other programs like
>> xrandr, xmodmap.
>>
>> However what makes it uneasy, catching output of programs  amixer, mpc,
>> uname like
>>
>> prg_out = io.popen('/bin/uname -r'):read('*a')
>>
>> does work, ie. rc.lua script doesn't hang and output is stored.
>>
>> I cann't find the source of problem. All mentioned programs are Linux ELF
>> executables, single or multiline output makes no difference, setting locales
>> to default (LANG=C LC_ALL=C) also makes no difference. And as already
>> stated, the issue manifests only when run from within rc.lua script.
>>
>> Any idea what I may have omitted ?
>>
>>
>> David
>>
>
>

--
To unsubscribe, send mail to [email protected].

Reply via email to