Skip to content

Commit 151797f

Browse files
committed
Use the correct just for just --fmt --unstable
One of the `justfile` recipes ran `just --fmt --unstable`, and did so as such. The problem with this is that the `just` executable in the outer `just` call is not guaranteed to be the same `just` that the inner call in the recipe finds. For example: - In general, a user might use a `just` that is not in `$PATH` even when another `just` is in `$PATH`. This would happen when testing changes to `just`, and potentially in other use cases. - The "inner" `just` is looked up by a POSIX-compatible shell that, on Windows, may have a changed environment. For example, the `sh.exe` shim provided by Git for Windows modifies environment variables including placing some directories in the front of `$PATH`. (See discussion in GitoxideLabs#1864 for details.) Thus `just` provides a built-in function `just_executable()` that can be used, and which we already use in the default recipe. This uses that function instead. However, it is not as simple as `{{ just_executable() }} --fmt --unstable`, because the path may require quoting to be run in a shell. In practice, it almost always needs to be quoted on Windows, where otherwise a `\` is being given to the shell (which the shell is required to interpret as a quoting character; this is distinct from a scenario where a path might be passed as an argument to a shell, in which case strange things may or may not occur). It might rarely need to be quoted on other systems too, it it has spaces or other even weirder contents. So this uses `{{ quote(just_executable()) }}`. It does so through the `j` variable that has already been assigned that value.
1 parent 4017229 commit 151797f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

justfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ summarize EXPRESSION='all()':
255255
fmt:
256256
cargo +nightly fmt --all -- --config-path rustfmt-nightly.toml
257257
cargo +stable fmt --all -- --check
258-
just --fmt --unstable
258+
{{ j }} --fmt --unstable
259259

260260
# Cancel this after the first few seconds, as yanked crates will appear in warnings.
261261
find-yanked:

0 commit comments

Comments
 (0)