5 Commits

Author SHA1 Message Date
Christian Clauss 44e8aebc41 ruff --select=FLY,UP --target-version=py37 --fix . 2023-06-30 08:36:14 +02:00
Tzu-ping Chung 6a93e6cf44 Quote arguments with carets for cmd.exe
Carets introduce a difficult situation since they are essentially
"lossy" when parses. Consider this in cmd.exe:

    > echo "foo^bar"
    "foo^bar"
    > echo foo^^bar
    foo^bar

The two commands produce different results, but are both parsed by the
shell as `foo^bar`, and there's essentially no sensible way to tell what
was actually passed in. This implementation assumes the quoted variation
(the first) since it is easier to implement, and arguably the more common
case.
2018-11-28 19:30:45 +08:00
Tzu-ping Chung 86a2786954 Quote command if it contains parentheses
The command can be safely quoted in this case since non-quotable commands
(cmd built-in) do not have parentheses.

Note that this change only applies to the command, not arguments.
Parentheses in arguments can be correctly interpreted without quotes, and
the quotes, like spaces, will cause incorrect outputs for echo etc.
2018-11-07 20:42:35 +09:00
Tzu-ping Chung 9315887101 Only quote arguments during cmdify if needed 2018-07-11 17:17:08 +08:00
Tzu-ping Chung 4533e68bca Move things around 2018-04-12 17:35:17 +08:00