diff --git a/Gemfile b/Gemfile index 851fabc..9aa5399 100644 --- a/Gemfile +++ b/Gemfile @@ -1,2 +1,3 @@ +# frozen_string_literal: true source 'https://rubygems.org' gemspec diff --git a/Rakefile b/Rakefile index 585095f..9f1e07d 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'bundler/gem_tasks' require 'bundler/setup' require 'rake/testtask' diff --git a/lib/subprocess.rb b/lib/subprocess.rb index cec2b27..fbf274c 100644 --- a/lib/subprocess.rb +++ b/lib/subprocess.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'thread' require 'set' @@ -169,7 +170,7 @@ class NonZeroExit < StandardError # @param [::Process::Status] status The status returned by `waitpid`. def initialize(cmd, status) @command, @status = cmd.join(' '), status - message = "Command #{command} " + message = +"Command #{command} " if status.exited? message << "returned non-zero exit status #{status.exitstatus}" elsif status.signaled? @@ -428,7 +429,7 @@ def drain_fd(fd, buf=nil) def communicate(input=nil, timeout_s=nil) raise ArgumentError if !input.nil? && @stdin.nil? - stdout, stderr = "", "" + stdout, stderr = +"", +"" # NB: Always force encoding to binary so we handle unicode or binary input # correctly across multiple write_nonblock calls, since we manually slice @@ -508,7 +509,7 @@ def communicate(input=nil, timeout_s=nil) if block_given? && !(stderr.empty? && stdout.empty?) yield stdout, stderr - stdout, stderr = "", "" + stdout, stderr = +"", +"" end end end diff --git a/lib/subprocess/version.rb b/lib/subprocess/version.rb index 30df7b4..534b9dc 100644 --- a/lib/subprocess/version.rb +++ b/lib/subprocess/version.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Subprocess VERSION = '1.5.6' end diff --git a/subprocess.gemspec b/subprocess.gemspec index eb0c0b4..dff41f2 100644 --- a/subprocess.gemspec +++ b/subprocess.gemspec @@ -1,4 +1,5 @@ # -*- encoding: utf-8 -*- +# frozen_string_literal: true lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'subprocess/version' diff --git a/test/test_subprocess.rb b/test/test_subprocess.rb index 20d0fb4..7b56ff2 100644 --- a/test/test_subprocess.rb +++ b/test/test_subprocess.rb @@ -1,4 +1,5 @@ # coding: utf-8 +# frozen_string_literal: true require 'rubygems' gem 'minitest' require 'minitest/autorun' @@ -436,7 +437,7 @@ def call_multiwrite_script(&block) it 'preserves encoding across IO selection cycles with a block given' do process = Subprocess::Process.new(['bash', '-c', script], :stdout => Subprocess::PIPE) - stdout = "" + stdout = +"" process.communicate do |out, _err| stdout << out @@ -450,7 +451,7 @@ def call_multiwrite_script(&block) assert_equal(Encoding::UTF_8, message.encoding) process = Subprocess::Process.new(['cat'], :stdin => Subprocess::PIPE, :stdout => Subprocess::PIPE) - stdout = "" + stdout = +"" process.communicate(message) do |out, _err| stdout << out end