Hi, 
  I have a strange behavior with the popen function when I use it with luajava.
  
  I use the luajava eclipse plugin, and try to execute this code (in a plugin 
Junit Test case) : 

===============================================
Junit Test case : 
@Test
public void popen()
{
      l.getGlobal("require");
      l.pushString("tests.simpletest");
      if (l.pcall( 1, 1, 0) != 0)
        l.error();      
      l.pop(-1);

      l.getGlobal("popenTest");
      if (l.pcall( 0, 0, 0) != 0)
        l.error();      
}
===============================================
Lua Test File :
function popenTest()
     print("test started !")
     p,msg = io.popen('dir');
     if not p then error("popen (dir) return nil. msg : ".. tostring(msg)) end
     print ("p : ".. tostring(p))
     l,msg = p:read("*l");  
     if not l then error("read (popen (dir)) return nil. msg :".. 
tostring(msg)) end
     print (l)
     print("test done !")
end
===============================================
And I get this result : 
test started !
p : file (18EE1AA0)
PANIC: unprotected error in call to Lua API 
(...project.luaeclipse.lua.test\lua\tests\simpletest.lua:7: read (popen (dir)) 
return nil. msg :nil)
===============================================

I try with p:read(1) instead of p:read("*l"), and I get the same result.
I also try with p:read("*a") and I get :
test started !
p : file (18EE1AA0)

test done !

I try with another command than 'dir' like 'echo toto' or with  my own 
executable and a fullpath reference to it. I get the same problem.
When I try without luajava, this works well.

I only run my test on windows. (I will try on linux now)

It seems this is a bug, if  you have any idea to solve this problem ? (or 
perhaps a workaround ?)

Thanks you.

Simon 


_______________________________________________
Kepler-Project mailing list
[email protected]
http://lists.luaforge.net/cgi-bin/mailman/listinfo/kepler-project
http://www.keplerproject.org/

Reply via email to