On 2025-02-10 12:32, Brian Inglis via Cygwin wrote: > One can avoid any issues by running Cygwin programs only from other Cygwin > programs, and Windows programs only from other Windows programs.
Microsoft has provided a documented algorithm, which is implemented in the ShellAPI function CommandLineToArgvW, and in the CRT module that prepares arguments for the main or wmain functions of Microsoft Visual C/C++ programs. I believe that the algorithm is sound in that it can round-trip any argv[] vector to string, and then back to recover an identical argv[]. (Am I correct?) If that is the case, there is no reason why a POSIX layer on Windows would not use that algorithm, since it meets its requirements for passing an argv[] from one process to another, and is compatible with recommendations from the OS vendor, with a reference implementation (for the parsing direction) present in every Windows (ShellAPI). What I've noticed in Cygwin is that it destroys the command line! When you call GetCommandLineW in a Cygwin process, you get an empty line. I recently posted here about this. That means you cannot ignore the arguments given in main() and just do it yourself. -- 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