10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/covalence/core/cli_wrappers/popen_wrapper.rb', line 10
def run(cmds, path, args,
stdin_io: STDIN,
stdout_io: STDOUT,
stderr_io: STDERR,
debug: Covalence::DEBUG_CLI,
dry_run: false,
ignore_exitcode: false,
workdir: nil)
cmd_string = [*cmds]
cmd_string += [*args] unless args.blank?
cmd_string << path unless workdir
run_cmd = cmd_string.join(' ')
print_cmd_string(run_cmd)
if dry_run
run_cmd = Covalence::DRY_RUN_CMD
end
if debug
return 0 unless HighLine.new.agree('Execute? [y/n]')
end
if workdir
spawn_subprocess(ENV, run_cmd,
stdin_io: stdin_io,
stdout_io: stdout_io,
stderr_io: stderr_io,
ignore_exitcode: ignore_exitcode,
path: path,
workdir: workdir)
else
spawn_subprocess(ENV, run_cmd,
stdin_io: stdin_io,
stdout_io: stdout_io,
stderr_io: stderr_io,
ignore_exitcode: ignore_exitcode,
path: path)
end
end
|