Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mise watch -t <task> runs in .config directory (not <project>) when using <project>/.config/mise.toml | <project>/.config/mise.*.toml #2631

Open
IanLuites opened this issue Sep 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@IanLuites
Copy link

IanLuites commented Sep 24, 2024

Describe the bug
mise watch -t <task> runs in wrong directory when using <project>/.config/mise.toml | <project>/.config/mise.*.toml.

To Reproduce

  1. Create a new mise task under <project>/.config/mise.toml.
  2. Run task with mise watch -t <task>

Now the task runs and watches in <project>/.config.

Expected behavior

Expect task directory to match mise run <task> and be <project>.

Reproduce with script

mkdir ./repr_watch_cwd
cd ./repr_watch_cwd
mkdir ./.config
echo '[tasks]
  [tasks.cat]
    run = "cat example.txt"
    sources = ["example.txt"]
' > ./.config/mise.toml
echo 'Hello' > example.txt

Now notice:
mise run cat
⚠️ mise watch -t cat

Because for the second it tries to watch and read .config/example.txt.

Additional context

It seems when looking at src/config/config_file/mise_toml.rs that there is a check for dir.ends_with(".config/mise"), but not dir.ends_with(".config") afterwards.

And I can confirm that in the example above moving the file from .config/mise.toml to .config/mise/config.toml avoids the issue. (mkdir .config/mise && mv ./.config/mise.toml ./.config/mise/config.toml for the script.)

`mise doctor` output
version: 2024.9.7 linux-x64 (743b7a7 2024-09-23)
activated: yes
shims_on_path: no

build_info:
  Target: x86_64-unknown-linux-gnu
  Features: DEFAULT, NATIVE_TLS, OPENSSL
  Built: Mon, 23 Sep 2024 21:09:00 +0000
  Rust Version: rustc 1.81.0 (eeb90cda1 2024-09-04)
  Profile: release

shell:
  /usr/bin/zsh
  zsh 5.9 (x86_64-ubuntu-linux-gnu)

dirs:
  data: ~/.local/share/mise
  config: ~/.config/mise
  cache: ~/.cache/mise
  state: ~/.local/state/mise
  shims: ~/.local/share/mise/shims

config_files:
  ~/.config/mise/config.toml
  ~/example/.config/mise.toml

backends:
  cargo
  core
  go
  npm
  pipx
  spm
  ubi
  vfox

plugins:
  bats        https://github.com/timgluz/asdf-bats.git#299551f
  elixir      https://github.com/mise-plugins/mise-elixir.git#8efb115
  erlang      https://github.com/asdf-vm/asdf-erlang.git#826ad0e
  gleam       https://github.com/asdf-community/asdf-gleam.git#82a21e0
  pnpm        https://github.com/jonathanmorley/asdf-pnpm.git#184f8cb
  protoc      https://github.com/paxosglobal/asdf-protoc.git#a44c5cd
  rebar       https://github.com/Stratus3D/asdf-rebar.git#827ef1b
  rust        https://github.com/code-lever/asdf-rust.git#95acf4f
  shellcheck  https://github.com/luizm/asdf-shellcheck.git#66200ff
  upx         https://github.com/jimmidyson/asdf-upx.git#5e0e639
  watchexec   https://github.com/nyrst/asdf-watchexec.git#b667a08
  yamllint    https://github.com/ericcornelissen/asdf-yamllint.git#d8c041a
  yarn        https://github.com/mise-plugins/asdf-yarn.git#74ea3b9

toolset:
  elixir@1.17.3-otp-27
  erlang@27.1
  gleam@1.5.0
  go@1.23.1
  node@22.9.0
  rust@1.81.0
  go:github.com/boyter/scc/v3@3.3.5
  cargo:cargo-binstall@1.10.3
  cargo:cargo-asm@0.1.16
  cargo:cargo-edit@0.12.3
  watchexec@2.1.2

env_vars:
  MISE_SHELL=zsh

settings:
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf = true
  asdf_compat = false
  cache_prune_age = "30d"
  cargo_binstall = true
  color = true
  disable_default_shorthands = false
  disable_hints = []
  disable_tools = []
  experimental = true
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  http_timeout = 30
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  libgit2 = true
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  pipx_uvx = false
  plugin_autoupdate_last_check_duration = "7d"
  python_default_packages_file = "~/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  use_versions_host = true
  verbose = false
  vfox = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"
  python_venv_auto_create = false

  [ruby]
  default_packages_file = "~/.default-gems"
  ruby_build_repo = "https://github.com/rbenv/ruby-build.git"
  ruby_install = false
  ruby_install_repo = "https://github.com/postmodern/ruby-install.git"

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

1 warning found:

1. plugin erlang overrides a core plugin

No problems found
</details>
@IanLuites IanLuites added the bug Something isn't working label Sep 24, 2024
@IanLuites IanLuites changed the title mise watch -t <task> runs in wrong directory when using <cwd>/.config/mise.toml \ mise watch -t <task> runs in wrong directory when using <project>/.config/mise.toml | <project>/.config/mise.*.toml Sep 24, 2024
@IanLuites IanLuites changed the title mise watch -t <task> runs in wrong directory when using <project>/.config/mise.toml | <project>/.config/mise.*.toml mise watch -t <task> runs .config directory (not <project>) when using <project>/.config/mise.toml | <project>/.config/mise.*.toml Sep 24, 2024
@IanLuites IanLuites changed the title mise watch -t <task> runs .config directory (not <project>) when using <project>/.config/mise.toml | <project>/.config/mise.*.toml mise watch -t <task> runs in .config directory (not <project>) when using <project>/.config/mise.toml | <project>/.config/mise.*.toml Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant