[code] Re: [textadept] spawn(argv, ...

From: Richard Philips <richard.philips.att.gmail.com>
Date: Thu, 22 May 2014 15:51:45 +0200

Hello Mitchell,

>
> Forgive me for asking, but why not add your properly quoted arguments to a
> table and then pass the result of `table.concat()` to `spawn()`?
>
>
>
I wrote several lua modules which activates software on the workstation
where textadept is functioning.

This software has to be used by several people on a mix of software
platforms (3 flavours of Windows, OSX, 2 flavours of Linux)

"properly quoting" the arguments for all these platforms is not so easy
(quoting is depending on the shell in use), add to that pathnames
containing spaces (common on Windows).

Parsing arguments is particular difficult on Windows (
http://stackoverflow.com/questions/4094699/how-does-the-windows-command-interpreter-cmd-exe-parse-scripts),
as it is NOT cmd.exe which does the job but the parsing is dependent on the
program itself!

So, I hoped that you could immediately call the relevant C spawn functions
:-)

I solved the problem in another way (but I pay a - small - price for it, a
price I hoped to evade :-)

I wrote a small program (which I put in the PATH) and which works with one
variable. This is the name of a JSON file in the temporary directory.

The JSON file contains the executable and all relevant arguments (even
stdout, stderr, stdin). The small program launches then the executable
without making use of the shell.

It seems (and it is) cumbersome but it works flawless on all platforms.

Richard

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Thu 22 May 2014 - 09:51:45 EDT

This archive was generated by hypermail 2.2.0 : Fri 23 May 2014 - 06:35:28 EDT