Re: Something wrong with cygstart

Christian Franke via Cygwin <[email protected]>
Newsgroups gmane.os.cygwin
Message-ID <[email protected]>
Andrey Repin via Cygwin wrote:
> Greetings, Christian Franke via Cygwin!
>
>> Andrey Repin via Cygwin wrote:
>>> I'm using a wrapper script to comfortably start VS Code from file manager.
>>>
>>> The last line of it is
>>>
>>> cygstart --hide -- "/proc/cygdrive/c/Program Files/Microsoft VS Code/bin/code.cmd" "$(cygpath -alw "$_arg")"
>>>
>>> It works well up to the point where there are no spaces in the $_arg. But on
>>> the first seen space it break the arguments list into pieces.
>>> I have to double-quote the argument to maintain the consistency, like
>>>
>>> cygstart --hide -- "/proc/cygdrive/c/Program Files/Microsoft VS Code/bin/code.cmd" "\"$(cygpath -alw "$_arg")\""
>>>
>>> but that's a questionable solution at best.
>> This is as expected. Unlike Cygwin's exec() emulation, cygstart does not
>> add any quoting during conversion of the argv[] array to the plain argument
>> string required for Windows process creation API.
> Which is rather surprising, considering I've had these scripts for years.
> Guess I was just TOO lucky to not stumble upon the issue sooner.

Yes, as this behavior of cygstart has never changed since its early days 
(v1.0.0 from 2002-03-16):
https://sourceware.org/git/?p=cygwin-apps/cygutils.git;a=tree;f=src/cygstart


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.