From 3072c61568f2c32d5720284c5bc27ae9e0764597 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Mon, 15 Jul 2024 09:31:30 +0100 Subject: [PATCH] fix(xbar/mise-updates): ensure commands all run within the env root --- xbar/mise-updates.1h.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/xbar/mise-updates.1h.rb b/xbar/mise-updates.1h.rb index d6daaf2..6c02112 100755 --- a/xbar/mise-updates.1h.rb +++ b/xbar/mise-updates.1h.rb @@ -4,7 +4,7 @@ # rubocop:disable Layout/LineLength # Mise Updates -# v0.1.0 +# v0.1.1 # Jim Myhrberg # jimeh # List and manage outdated tools installed with mise @@ -606,6 +606,9 @@ module Mise end return unless env_tools.size.positive? + mise_cmd_args = [mise_path] + mise_cmd_args += ['--cd', env.path] unless env.global? + printer.sep printer.item(env.full_name) @@ -626,13 +629,13 @@ module Mise cmds = [] if to_install.size.positive? - cmds += [mise_path, 'install'] + to_install.map do |t| + cmds += mise_cmd_args + ['install'] + to_install.map do |t| t.install_arg(env) end end if to_upgrade.size.positive? cmds << '&&' if cmds.size.positive? - cmds += [mise_path, 'upgrade'] + to_upgrade.map do |t| + cmds += mise_cmd_args + ['upgrade'] + to_upgrade.map do |t| t.upgrade_arg(env) end end @@ -678,7 +681,7 @@ module Mise text, alt: alt_text || text, terminal: true, refresh: true, - shell: [mise_path, mise_operation.to_s, tool_arg] + shell: mise_cmd_args + [mise_operation.to_s, tool_arg] ) printer.sep @@ -761,8 +764,8 @@ module Mise printer.item( 'Yes', terminal: true, refresh: true, - shell: [ - mise_path, 'uninstall', "#{tool.name}@#{v.version}" + shell: mise_cmd_args + [ + 'uninstall', "#{tool.name}@#{v.version}" ] ) end