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

From: Mitchell <m.att.foicica.com>
Date: Thu, 22 May 2014 09:25:09 -0400 (Eastern Daylight Time)

Hi Richard,

On Wed, 21 May 2014, Richard Philips wrote:

> Hi Mitchell,
>
> I would like to propose an alternative way to call spawn.
>
>
> The first argument (argv) is a string describing the commandline and
> arguments.
>
> This is ok, but it is shell dependent and is quite difficult to work with
> (MS-Windows has its own problems)
>
>
> I propose:
>
> - if type(argv) == 'string' --> existing behaviour
>
> - if type(argv) == 'table' -->
> first argument is name of the executable
> second argument: first parameter to the executable
> ...
>
>
>
> What do you think?
> (The idea originated in Python's subprocess module)

I don't care for this idea. GTK requires an argv[] style argument for
spawning processes, while Windows requires a command line string. GTK
provides a function to parse a command line string into argv[], but
Windows doesn't seem to have a way to convert argv[] into a command line
string. The latter is particularly problematic because I'd have to write
code to properly quote arguments, which is error-prone. Therefore, it's
easiest to require only a command line string that assumes the user has
properly quoted the arguments.

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()`?

Cheers,
Mitchell

-- 
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:25:09 EDT

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