Re: [code] [textadept] spawn() in Win with quoted strings

From: Mitchell <m.att.foicica.com>
Date: Sun, 12 Mar 2017 08:54:11 -0400 (EDT)

Hi Giobanni,

On Sat, 11 Mar 2017, Giovanni Salmeri wrote:

> Hello everybody.
>
> There is something in spawn in Win that I don't understand. I have to
> spawn a program with two filenames as arguments. This works:
>
> spawn('path/program.exe path/file1 path/file2')
>
> But I should quote both the name of the program and those of each of the
> files, because it is possible that they contain spaces. Now, this
> does *not* work:
>
> spawn('"path/program.exe" "path/file1" "path/file2"')
>
> But if I quote either the name of the program or the names of the
> files, it does work like expected:
>
> spawn('path/program.exe "path/file1" "path/file2"')
> spawn('"path/program.exe" path/file1 path/fil2e')
>
> It seems very strange to me... (If it is of interest, the program is in
> Python, generated by pyinstaller, and uses the module argparse.) Any
> hints or suggestions? Thank you!

On Windows the spawn function actually runs:

   %COMSPEC% /c [program passed to spawn]

Perhaps that might explain this curiosity, but I'm not really sure since
I'm not very familiar with Windows.

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 Sun 12 Mar 2017 - 08:54:11 EDT

This archive was generated by hypermail 2.2.0 : Mon 13 Mar 2017 - 06:38:32 EDT