Method initialize
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
def initialize(env_or_cmd, *args)
opts = args.last.respond_to?(:to_hash) ? args.pop : {}
if env_or_cmd.respond_to?(:to_hash)
@env = env_or_cmd
unless command = args.shift
Method spawn
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
def spawn(cmd)
process_opts = normalize_redirect_options(cmd.options)
binmode = cmd.options[:binmode] || false
pty = cmd.options[:pty] || false
verbose = cmd.options[:verbose]
Method spawn
has 46 lines of code (exceeds 25 allowed). Consider refactoring.
def spawn(cmd)
process_opts = normalize_redirect_options(cmd.options)
binmode = cmd.options[:binmode] || false
pty = cmd.options[:pty] || false
verbose = cmd.options[:verbose]
Method write_stream
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
def write_stream(stream, input)
start = Time.now
writers = [input && stream].compact
while writers.any?
Method read_stream
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
def read_stream(stream, handler)
Thread.new do
if Thread.current.respond_to?(:report_on_exception)
Thread.current.report_on_exception = false
end
Method initialize
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
def initialize(env_or_cmd, *args)
opts = args.last.respond_to?(:to_hash) ? args.pop : {}
if env_or_cmd.respond_to?(:to_hash)
@env = env_or_cmd
unless command = args.shift
Method write
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
def write(cmd, message, data = nil)
cmd_set_uuid = cmd.options.fetch(:uuid, true)
uuid_needed = cmd.options[:uuid].nil? ? @uuid : cmd_set_uuid
out = []
if uuid_needed
Method wait
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
def wait(*args)
pattern = args.pop
unless pattern
raise ArgumentError, "Please provide condition to wait for"
end
Method read_streams
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def read_streams(stdout, stderr)
stdout_data = []
stderr_data = Truncator.new
out_handler = ->(data) {