diff --git a/bin/rubyshell b/bin/rubyshell index 6cfc214..c6caa6d 100755 --- a/bin/rubyshell +++ b/bin/rubyshell @@ -1,6 +1,8 @@ -#!/usr/bin/env ruby +#!/usr/bin/env -S ruby --disable-gems # frozen_string_literal: true +$LOAD_PATH.unshift(File.expand_path("../lib", __dir__)) + require "rubyshell" if ARGV.first&.strip&.start_with? "exec" diff --git a/lib/rubyshell.rb b/lib/rubyshell.rb index c97ade9..0dc63e1 100644 --- a/lib/rubyshell.rb +++ b/lib/rubyshell.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require "logger" - require_relative "rubyshell/version" require_relative "rubyshell/command" require_relative "rubyshell/chainer" @@ -43,6 +41,8 @@ def debug? attr_writer :logger def logger + require "logger" + @logger ||= Logger.new($stdout) end diff --git a/lib/rubyshell/chainer.rb b/lib/rubyshell/chainer.rb index 512c676..ab32002 100644 --- a/lib/rubyshell/chainer.rb +++ b/lib/rubyshell/chainer.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require "debug" module RubyShell class Chainer attr_reader :parts, :options diff --git a/lib/rubyshell/terminal_executor.rb b/lib/rubyshell/terminal_executor.rb index 3daff1d..1252391 100644 --- a/lib/rubyshell/terminal_executor.rb +++ b/lib/rubyshell/terminal_executor.rb @@ -34,7 +34,7 @@ def self.capture(command, options) # rubocop:disable Metris/MethodLength,Metrics until ios.empty? status ||= w_thread.join(0) - readable, = IO.select(ios.keys, nil, nil, 0) + readable, = IO.select(ios.keys, nil, nil, SELECT_TIMEOUT) break if !readable && status next unless readable