Skip to content

Commit b299d78

Browse files
committed
expose ability to run commands in display environment
1 parent 21c5a8e commit b299d78

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/arduino_ci/display_manager.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,24 @@ def with_display
8080
end
8181
end
8282

83+
# run a command in a display
84+
def run(env, args, **kwargs)
85+
ret = false
86+
with_display do |env_vars|
87+
env_vars = {} if env_vars.nil?
88+
env_vars.merge!(env) unless env.nil?
89+
full_cmd = env_vars.empty? ? args : [env_vars] + args
90+
puts "Running #{env_vars} $ #{args.join(' ')}"
91+
ret = system(*full_cmd, **kwargs)
92+
end
93+
ret
94+
end
95+
96+
# run a command in a display with no output
97+
def run_silent(env, *args)
98+
run(env, args, out: File::NULL, err: File::NULL)
99+
end
100+
83101
def environment
84102
return nil unless @existing || @enabled
85103
return {} if @existing

0 commit comments

Comments
 (0)