Hi Nicolas,

it unfortunately does not matter if I execute xrandr at the beginning
(immediately after modules loading) or as the last command in the rc.lua
script.

When io.popen("xrandr") is called inside callback funtion (like handler of
timer event, mouse events etc.), ie. after whole rc.lua is processed, it
does work - io.popen or os.execute does return. However the same call
anywhere inside rc.lua, ie. before Awesome is completely initialized, these
functions never return.

Paradoxically some subset of applications is _not_ afflicted with the
mentioned issue. For example io.popen('/bin/uname') called anywhere inside
rc.lua immediately returns with contents of standard output. I see no
difference between uname and xrandr: both do not wait for standard input,
both write to standard output only (no stderr), both are ELF executables. I
see nothing special.

I have to add I'm using current Git build of Awesome (from the end of
September).
Do read this mailinglist Awesome devs ?
Should I fill bug report on Flyspry ?

Does anybody know what's special with rc.lua processing, ie. different from
running common Lua script ?

Thanks in an advance.

David


On Sun, Oct 3, 2010 at 5:26 PM, Cyprien Nicolas <[email protected]> wrote:

> On Sat, Oct 2, 2010 at 01:41, 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.
> >
>
> It works for me, for xrandr.I have a widget for controlling the
> back-light of my laptop.
>
> Where do you call xrandr in your rc.lua ? Maybe you're calling it too
> early during the starting process, and all the X features are not
> initialized ?
> I do remember I had a problem with xrandr --prop, as I delayed the
> first query by 10 seconds, but I cannot remember the issue I
> encountered.
>
> You can try something like
>
> function testXRandr()
>   local fd = io.popen("xrandr --prop")
>   local stdout = fd:read("*all")
>   fd:close()
> -- do something with stdout
> end
>
> mytimer = timer({ timeout = 10 })
> mytimer:add_signal("timeout", testXRandr)
> mytimer:start()
>
> Hope that's help
>
> --
> Cyprien Nicolas
> PhD Student in Computer Science
> INRIA Sophia Antipolis Méditerranée
> University of Nice - Sophia Antipolis
>

Reply via email to