39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/pdk/cli/exec/interactive_command.rb', line 39
def execute!
require 'pdk/util'
@resolved_env = resolved_env_for_command
if [:module, :pwd].include?(context)
mod_root = PDK::Util.module_root
raise PDK::CLI::FatalError, 'Current working directory is not part of a module. (No metadata.json was found.)' unless mod_root
unless context == :pwd || Dir.pwd == mod_root
orig_workdir = Dir.pwd
Dir.chdir(mod_root)
end
result = run_process_in_clean_env!
else
result = run_process!
end
{
interactive: true,
stdout: nil,
stderr: nil,
exit_code: result[:exit_code],
duration: result[:duration]
}
ensure
Dir.chdir(orig_workdir) if orig_workdir
end
|