lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 20/09/2022 10:44, Marvin Scholz wrote:

On 20 Sep 2022, at 9:47, Tomas Mudrunka wrote:


os.execute({"sync", "filename"});

lua can detect that table was passed rather than string. and
bypass the shell in that case. That would prevent need to have shell-specific (platform-specific) escaping in lua...

Unfortunately on Windows that is not so trivial to do:

That article is really interesting. Thanks for the reference.

Command quoting for complex shell commands, especially if started from within another program, has always been a PITA in Windows. See for example how cmd.exe processes the command line for quotes (scroll down to mid-page):

That's also why I grew the habit of creating file names rigorously using ASCII chars alone AND no spaces (using underscores instead). It's so ingrained in me that I subconsciously consider a space just a command separator and not a legal char for filenames.

That has saved me lots of grief sometimes, at the cost of being seen somewhat as a weirdo by colleagues with no programming background (I do that also with documents that don't have to be processed by tools, like PDF mail attachments). :-)