File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,28 @@ def with_display
81
81
end
82
82
end
83
83
84
+ # run a command in a display
85
+ def run ( *args , **kwargs )
86
+ ret = false
87
+ # do some work to extract & merge environment variables if they exist
88
+ has_env = !args . empty? && args [ 0 ] . class == Hash
89
+ with_display do |env_vars |
90
+ env_vars = { } if env_vars . nil?
91
+ env_vars . merge! ( args [ 0 ] ) if has_env
92
+ actual_args = has_env ? args [ 1 ..-1 ] : args # need to shift over if we extracted args
93
+ full_cmd = env_vars . empty? ? actual_args : [ env_vars ] + actual_args
94
+
95
+ puts "Running #{ env_vars } $ #{ args . join ( ' ' ) } "
96
+ ret = system ( *full_cmd , **kwargs )
97
+ end
98
+ ret
99
+ end
100
+
101
+ # run a command in a display with no output
102
+ def run_silent ( *args )
103
+ run ( *args , out : File ::NULL , err : File ::NULL )
104
+ end
105
+
84
106
def environment
85
107
return nil unless @existing || @enabled
86
108
return { } if @existing
You can’t perform that action at this time.
0 commit comments