[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: sh module (WAS: Re: Is "scripting" truly Lua's future?)
- From: "David Manura" <dm.lua@...>
- Date: Tue, 16 Sep 2008 01:58:15 -0400
On Tue, Sep 16, 2008 at 1:07 AM, Norman Ramsey wrote:
> > > A function os.quote that takes a Lua string and quotes it using
> > > Bourne shell conventions,
The "fs" module in LuaRocks portably implements certain non-ANSI file
system commands using only shell commands (os.execute/io.popen). It
is intentionally designed to run on a bare Lua installation (i.e.
without lposix/luafilesystem). In particular, it uses a utility
function "Q" (a.k.a. "fs_Q") that quotes an argument for shell
processing and a function "execute" (a.k.a. "fs_execute") that quotes
a list of arguments and runs the command. This might be made into
reusable module(s) or merged with your code.
http://luaforge.net/plugins/scmcvs/cvsweb.php/luarocks/src/luarocks/fs.lua?rev=HEAD;cvsroot=luarocks
http://luaforge.net/plugins/scmcvs/cvsweb.php/luarocks/src/luarocks/fs/unix.lua?rev=HEAD;cvsroot=luarocks
http://luaforge.net/plugins/scmcvs/cvsweb.php/luarocks/src/luarocks/fs/win32.lua?rev=HEAD;cvsroot=luarocks
This is a common need. I recently wrote a Lua script that acted as a
proxy to another command (passing arg arguments to os.execute). This
required consideration of the obscure quoting rules on Win32. Ideally
this should have been abstracted in a module.