casey / just

🤖 Just a command runner
https://just.systems
Creative Commons Zero v1.0 Universal
21.43k stars 477 forks source link

Windows path backslashes removed from command args #2467

Open cedws opened 4 hours ago

cedws commented 4 hours ago

I'm on Windows and would like to pass a Windows-style path with backslashes to a program like so:

echo *args:
    echo {{ args }}

When I invoke this target like so, the backslashes are removed making the path incorrect:

$ just echo "E:\\test"
echo E:\\test
E:test

I thought PowerShell could also be the culprit, but invoking echo directly works as expected:

$ echo "E:\\test"
E:\\test

Just version: just 1.36.0

laniakea64 commented 3 hours ago

When I invoke this target like so, the backslashes are removed making the path incorrect:

$ just echo "E:\\test"
echo E:\\test
E:test

I'm not familiar with Windows/PowerShell, but maybe this output might be showing what's happening? -

The args recipe parameter is not a list of arguments. It's a single string containing all received arguments separated by spaces - https://just.systems/man/en/recipe-parameters.html So for example just echo "E:\\test" "E:\\testing 1 2 3" would invoke echo recipe with args parameter set to E:\\test E:\\testing 1 2 3, so the command in the recipe body would become literally echo E:\\test E:\\testing 1 2 3.

To find out whether this is the actual issue: