[Dev-luatex] os.spawn and argv[1] with sapces

Jonathan Fine jfine at pytex.org
Mon Nov 23 23:31:27 CET 2009


Taco Hoekwater wrote:
> 
> Hi Tomek,
> 
> T T wrote:
>> Hi,
>>
>> I have encountered a problem with os.spawn(arg) on Windows. If
>> arg[1]='foo bar' and arg[0]=nil, then the spawned process gets 'foo'
>> as argv[0] and 'bar' as argv[1]. This might be expected, since
>> according to docs, os.spawn doesn't do any argument processing.
> 
> Let's put it this way: windows command line processing does not
> agree with my neurons, so I have stayed way from it as much as
> possible (and will continue to do so).
> 
> A good, clean patch would be welcome of course, but I myself will not
> spend any more time on the stuff, not even for bug reports, as all that
> would be accomplished by doing so is that it would give me a headache,
> and there are much more pleasing ways to reach that state.

The Python community have solved this problem, with the subprocess module.
     http://docs.python.org/library/subprocess.html

To quote from that URL
====
The subprocess module allows you to spawn new processes, connect to 
their input/output/error pipes, and obtain their return codes. This 
module intends to replace several other, older modules and functions, 
such as:

os.system
os.spawn*
os.popen*
popen2.*
commands.*
====

The specification for subprocess is at
     http://www.python.org/dev/peps/pep-0324/

If anyone would like to create a module for lua to solve the problem of 
filenames with spaces then Python's subprocess would be a good place to 
start.

-- 
Jonathan




More information about the dev-luatex mailing list