lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


--===========
function shell(c)
  execute(c.." > _temp")
  local input = _INPUT
  local o, h
  h = readfrom('_temp')
  o = read("*a")
  closefile(h)
  execute("del _temp")
  _INPUT = input
  return o
end

local result = shell("dir")
print(result)

--=========

CRIBBSJ wrote:
> 
> This is probably going to be a pretty basic question, but how do you return
> the result of an execute() call.  For example, on windows I want to do a:
> 
> execute("dir")
> 
> and get back the directory listing.  Instead, all I get is a status code.  I
> have looked at the docs, but it only talks about the status code.
> 
> Thanks in advance for any help.
> 
> Jamey.

-- 
Marcos