You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When the -C/--cd option is used with mise run the command panics.
To Reproduce
Create a directory with a .mise.toml with the following contents:
$ cat /tmp/foo/.mise.toml
[env]
FOO=123
[tasks.get_env]
run = 'printenv "$@"'
The task will execute as expected if running from the target directory (note: I'm using the shims and shell hooks):
$ cd /tmp/foo
$ echo$FOO
123
$ printenv FOO
123
$ mise run get_env FOO
[get_env] $ printenv "$@"
123
However, if the -C/--cd option is used, then I get a panic:
$ cd /tmp
$ export RUST_BACKTRACE=1
$ mise run -C /tmp/foo get_env FOO
The application panicked (crashed).
Message: Mismatch between definition and access of `cd`. Could not downcast to TypeId { t: 113748309191418191917298836948495794923 }, need to downcast to TypeId { t: 147963437875188584260812411993370060665 }
Location: /Users/brew/Library/Caches/Homebrew/cargo_cache/registry/src/index.crates.io-6f17d22bba15001f/clap_builder-4.5.2/src/parser/error.rs:32
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⋮ 8 frames hidden ⋮
9: mise::config::settings::Settings::add_cli_matches::h9fd0e7c302c03418
at <unknown source file>:<unknown line>
10: mise::cli::Cli::run::heea91d526ac28f59
at <unknown source file>:<unknown line>
11: mise::main::h6d60340e59b266c1
at <unknown source file>:<unknown line>
12: std::sys_common::backtrace::__rust_begin_short_backtrace::h96cd15775b13fe1a
at <unknown source file>:<unknown line>
13: _main<unknown>
at <unknown source file>:<unknown line>
Interestingly, the error is slightly different when the -C/--cd option is moved to the top level:
$ mise -C /tmp/foo run get_env FOO
The application panicked (crashed).
Message: Mismatch between definition and access of `cd`. Could not downcast to TypeId { t: 147963437875188584260812411993370060665 }, need to downcast to TypeId { t: 113748309191418191917298836948495794923 }
Location: /Users/brew/Library/Caches/Homebrew/cargo_cache/registry/src/index.crates.io-6f17d22bba15001f/clap_builder-4.5.2/src/parser/error.rs:32
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⋮ 8 frames hidden ⋮
9: <mise::cli::run::Run as clap_builder::derive::FromArgMatches>::from_arg_matches_mut::h064e4b1f2bbf8f87
at <unknown source file>:<unknown line>
10: mise::cli::Cli::run::heea91d526ac28f59
at <unknown source file>:<unknown line>
11: mise::main::h6d60340e59b266c1
at <unknown source file>:<unknown line>
12: std::sys_common::backtrace::__rust_begin_short_backtrace::h96cd15775b13fe1a
at <unknown source file>:<unknown line>
13: _main<unknown>
at <unknown source file>:<unknown line>
note: the TypeIds are permuted in this case. Looking at the source, it appears that the cd option is defined at the top-level for mise command (as type String) and also for the run (as type PathBuf). It is not defined separately for the exec command, which is probably why it runs OK (though possibly is not operating as expected for a different reason - see #1843)
Expected behavior
The command should not crash and should resolve the environment variable (note: this may also fail to do so due to #1843)
Description
When the
-C/--cd
option is used withmise run
the command panics.To Reproduce
Create a directory with a
.mise.toml
with the following contents:$ cat /tmp/foo/.mise.toml [env] FOO=123 [tasks.get_env] run = 'printenv "$@"'
The task will execute as expected if running from the target directory (note: I'm using the shims and shell hooks):
However, if the
-C/--cd
option is used, then I get a panic:Interestingly, the error is slightly different when the
-C/--cd
option is moved to the top level:note: the
TypeId
s are permuted in this case. Looking at the source, it appears that thecd
option is defined at the top-level formise
command (as typeString
) and also for therun
(as typePathBuf
). It is not defined separately for theexec
command, which is probably why it runs OK (though possibly is not operating as expected for a different reason - see #1843)Expected behavior
The command should not crash and should resolve the environment variable (note: this may also fail to do so due to #1843)
mise doctor
outputAdditional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: