I also had a weird issue with a small perl script I scribbled up. It would work from inside the Lua interactive console and in Xephyr, but not in the real awesome. I eventually realized that in the script I had initialized the readline library (even though I didn't make use of it). Once I moved readline's initialization so that it was not initialized when awesome called the script, awesome calling popen worked as expected. I don't see why this would be the issue with xrandr, but maybe it will be of some help?
Cheers! Matt Spear [email protected] On Sun, Oct 3, 2010 at 10:46 AM, David Unric <[email protected]> wrote: > Thx Yussi. > > ~/.xsession-errors unfortunately does contain no error output concerning the > io.popen or os.execute calls from rc.lua . > > I did tried your code but io is proper system table already. > > io.stderr:write(tostring(io)) > local io=require("io") > io.stderr:write(tostring(io)) > > After inspection of ~/.xsession-errors both tables are equal. > > Regards > > David > > On Sun, Oct 3, 2010 at 7:00 PM, yussi divnal <[email protected]> > wrote: >> >> You mean io.popen()? >> what does your ~/.xsession-errors say (if anything)? >> That will be a complete guess, but try adding >> local io=require("io") or local io=io at the top of your rc.lua... >> also, run whatever you run in popen on a terminal to see it works >> >> >> On Sun, Oct 3, 2010 at 5:48 PM, David Unric <[email protected]> wrote: >> > Hi, >> > >> > it unfortunately does not matter if I split it in separate steps. It >> > never >> > gets to the line where the filehandle is closed. >> > Calling os.popen does create a separate process but even if rc.lua will >> > stop, the os.popen function has to return soon and give back control to >> > Awesome's rc.lua script. >> > >> > Thx for trying though. >> > >> > David >> > >> > On Sun, Oct 3, 2010 at 5:05 PM, yussi divnal >> > <[email protected]> >> > wrote: >> >> >> >> 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].
