process_helper 0.0.4 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 154c47c6e0861152617336f08883dcba48f765ea
4
- data.tar.gz: 13eb97ca9b9f66ebbb57eee5bc64f9beccfa7f61
3
+ metadata.gz: e70edb04eaa1cef03255ffd6976dca7b6218afaf
4
+ data.tar.gz: a5d9dc19df23427d66e3974504cefeea00e636f8
5
5
  SHA512:
6
- metadata.gz: fafd1e2c31f8a260fc222c3c78c48910447141c2235205ea755c1ba489773a611ee2e9a692d8b9867058b808df9fb86698f85922e053f972539138eee39b31bf
7
- data.tar.gz: 128f4cde70775dac6c33302b60fcbcc39e633dd61404ea567364a1da2ec1dbce7ff93b05858eb111289e261e2a461eceefd96f59aa0586259b878f2fe8934ede
6
+ metadata.gz: 1ed2dd1a21c2e738f34971adf8b3328f1a30a1991dccf81b7bb6431e59fd2a0343f0e04cae2aaebf4091887148adf044d15ed52459c003d772c8db413e469ba5
7
+ data.tar.gz: 84a8dda43af5ac0486e709a3edd7b963221f5f34fac2c2daa1b39b87604c39ba8e081904b5500b192007d6a380e828002c0944c2bbe39b279d1772fafb23500a
@@ -10,7 +10,7 @@ require 'stringio'
10
10
  # Full documentation at https://github.com/thewoolleyman/process_helper
11
11
  module ProcessHelper
12
12
  # Don't forget to keep version in sync with gemspec
13
- VERSION = '0.0.4'.freeze
13
+ VERSION = '0.1.0'.freeze
14
14
 
15
15
  # rubocop:disable Style/ModuleFunction
16
16
  extend self
@@ -103,6 +103,10 @@ module ProcessHelper
103
103
  result = IO.select(nil, [stdin], nil, timeout)
104
104
  raise Timeout::Error if result.nil?
105
105
  retry
106
+ rescue Errno::EIO
107
+ # GNU/Linux raises EIO on read operation when pty slave is closed - see pty.rb docs
108
+ return output if options[:pseudo_terminal]
109
+ raise
106
110
  end
107
111
  rescue Timeout::Error
108
112
  handle_timeout_error(output, options)
@@ -3,7 +3,7 @@
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'process_helper'
5
5
  # Don't forget to keep version in sync with ProcessHelper::Version
6
- spec.version = '0.0.4'
6
+ spec.version = '0.1.0'
7
7
  spec.authors = ['Chad Woolley', 'Glenn Oppegard']
8
8
  spec.email = ['oppegard@gmail.com', 'thewoolleyman@gmail.com']
9
9
  spec.summary = "Makes it easier to spawn ruby sub-processes with proper capturing /
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency 'bundler', '~> 1.6'
22
22
  spec.add_development_dependency 'codeclimate-test-reporter', '~> 1'
23
23
  spec.add_development_dependency 'rake', '~> 10'
24
+ spec.add_development_dependency 'rainbow', '~> 2.1.0' # workaround for https://github.com/sickill/rainbow/issues/48#issuecomment-275454921, gem update --system no longer works
24
25
  spec.add_development_dependency 'rspec', '~> 3.1'
25
26
  spec.add_development_dependency 'rspec-retry', '~> 0.4'
26
27
  spec.add_development_dependency 'rubocop', '= 0.38.0' # exact version for static analyis libs
@@ -18,7 +18,7 @@ RSpec.describe ':include_output_in_exception option' do
18
18
  )
19
19
  end.to raise_error(
20
20
  ProcessHelper::UnexpectedExitStatusError,
21
- /Command output: "ls:.*\/does_not_exist: No such file or directory\n"/)
21
+ /Command output: "ls:.*\/does_not_exist.*No such file or directory\n"/)
22
22
  .and(output(/No such file or directory/).to_stdout)
23
23
  end
24
24
 
@@ -4,7 +4,6 @@ RSpec.describe 'pty handling' do
4
4
  attr_reader :clazz, :max_process_wait
5
5
 
6
6
  before do
7
- skip('pty specs do not work on travis or circle ci (try docker with -t option)') if ENV['CI']
8
7
  @clazz = Clazz.new
9
8
  end
10
9
 
@@ -34,6 +33,15 @@ RSpec.describe 'pty handling' do
34
33
  .and(not_output.to_stderr)
35
34
  end
36
35
 
36
+ it 'handles linux behavior of raising Errno::EIO when pty slave is closed' do
37
+ # nothing really special about this test, all the specs in this file
38
+ # fail on linux, just documenting...
39
+ expect do
40
+ clazz.process('echo "hi" && exit 1', pty: true, exp_st: 1)
41
+ end.to output(/hi/).to_stdout
42
+ .and(not_output.to_stderr)
43
+ end
44
+
37
45
  it 'does not require a newline or flush via getch' do
38
46
  skip('TODO: this test just hangs, including in a debugger')
39
47
  expect do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: process_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chad Woolley
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-02-19 00:00:00.000000000 Z
12
+ date: 2017-04-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -53,6 +53,20 @@ dependencies:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '10'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rainbow
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: 2.1.0
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 2.1.0
56
70
  - !ruby/object:Gem::Dependency
57
71
  name: rspec
58
72
  requirement: !ruby/object:Gem::Requirement
@@ -176,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
190
  version: '0'
177
191
  requirements: []
178
192
  rubyforge_project:
179
- rubygems_version: 2.6.8
193
+ rubygems_version: 2.5.2
180
194
  signing_key:
181
195
  specification_version: 4
182
196
  summary: Makes it easier to spawn ruby sub-processes with proper capturing / of stdout