lib/autoproj/cli/exec.rb in autoproj-2.3.1 vs lib/autoproj/cli/exec.rb in autoproj-2.4.0

- old
+ new

@@ -4,15 +4,21 @@ class Exec < InspectionTool def run(cmd, *args) initialize_and_load finalize_setup(Array.new) - # Resolve the command using the PATH if present - env = ws.full_env - if !File.file?(cmd) - cmd = env.find_in_path(cmd) || cmd + program = + begin ws.which(cmd) + rescue ::Exception => e + raise CLIInvalidArguments, e.message, e.backtrace + end + env = ws.full_env.resolved_env + + begin + ::Process.exec(env, program, *args) + rescue ::Exception => e + raise CLIInvalidArguments, e.message, e.backtrace end - exec(env.resolved_env, cmd, *args) end end end end