Module: ShellHelpers::Run::Interrupt

Extended by:
Interrupt
Included in:
Interrupt
Defined in:
lib/shell_helpers/run.rb

Overview

same as Run, but if we get interrupted once, we don't want to launch any more commands

Instance Method Summary collapse

Instance Method Details

#run(*command) ⇒ Object

TODO: handle non default options, 'error: :capture' would imply we need to return "", "", false



193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/shell_helpers/run.rb', line 193

def run(*command)
	if !@interrupted
		begin
			return Run.run(*command)
		rescue Interrupt #interruption
			@interrupted=true
			return "", false
		end
	else
		return "", false
	end
end

#run_command(*args) ⇒ Object



178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/shell_helpers/run.rb', line 178

def run_command(*args)
	if !@interrupted
		begin
			Run.run_command(*args)
		rescue Interrupt #interruption
			@interrupted=true
			return "", "", false
		end
	else
		return "", "", false
	end
end