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

Hans Hagen pragma at wxs.nl
Mon Nov 23 19:09:21 CET 2009


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.
> 
> So I tried double quoting arg[1]='"foo bar"' (i.e. double quotes are
> part of arg[1]) but then os.spawn fails with invalid argument error.
> Is this expected?
> 
> Furthermore, passing a string '"foo bar"' to os.spawn (including the
> double quotes) instead of a table, results in spawning 'foo bar' but
> again with 'foo' as argv[0] and 'bar' as argv[1]. The only way I found
> to properly spawn a command with spaces is by giving arg[0]
> explicitly:
> 
>  arg={[0]='foo bar', '"foo bar"', ...}


arg = {
     "dir",
     "bar",
     '"foo bar"',
}

os.spawn(arg)

works ok, so without arg[0]

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the dev-luatex mailing list