halfshell 0.1.4 → 0.1.5

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
  SHA256:
3
- metadata.gz: 8fdd86dfb3de440242b62befe43ca531f8d83725f725cbb7f36a944796f3d2b6
4
- data.tar.gz: 7996023279728c9dd636bc08d1cf052de82e8040b29cfb19bd6dc136f2da6eb0
3
+ metadata.gz: 65c7923b546781e694f70250eb14d2c119ed16664a7a170287389e10e86cf895
4
+ data.tar.gz: 443de88dc8348c3859e21ba978b5b1385c23cbf916f2ffc2c74db252f9b63da8
5
5
  SHA512:
6
- metadata.gz: '095c0223165806144a348421c7d37b5392fa1e14826e98b23fe7b0122e5c9e9057598912254e3c34ba4ec223539d1e7f979c5530d471709321abfb4ffc72572d'
7
- data.tar.gz: 0c1add843a5ddcdb2ae630c4d0c6c39b99c37f30940595b99ba381f6b9e3149faf90892af2eae9452075746061bc9b916c3ba9caacd62edbca67a597a516a0e2
6
+ metadata.gz: ba86ae2e4fedf21fa6012a96a06b29b5b67ba58a9997c01579c2ab072aeb12141aeda22a5986008d3f9526d1c73f023361e4b500f2473e82f8446c32bd8b2d4c
7
+ data.tar.gz: a1d232bf56a4dc983447d24eb44494b97103d498f533161f9efda10e798e71aafa74f21e095116eec50c423ac7549a73713376b2ba6c47b1b92723341d713b7f
@@ -1,7 +1,10 @@
1
1
  require "open4"
2
+ require "expect"
2
3
 
3
4
  module Halfshell
4
5
  class Terminal
6
+ TIMEOUT = 60 * 60
7
+ WAIT_INTERVAL = 1.0/1000
5
8
 
6
9
  def Terminal.default
7
10
  Terminal.sh
@@ -20,8 +23,8 @@ module Halfshell
20
23
  def initialize(stdin:, stdout:, stderr:, pid:)
21
24
  @stdin, @stdout, @stderr, @pid = stdin, stdout, stderr, pid
22
25
 
23
- @try = 0
24
- @limit = 1000
26
+ @tries = 0
27
+ @max_tries = (TIMEOUT / WAIT_INTERVAL).to_i
25
28
  end
26
29
 
27
30
  def puts(what)
@@ -44,10 +47,10 @@ module Halfshell
44
47
  rescue IO::EAGAINWaitReadable
45
48
  raise_error if too_many_tries?
46
49
  if got.empty?
47
- sleep(1.0/1000) #sleep(WAIT*@backoff.next)
50
+ sleep(WAIT_INTERVAL)
48
51
  return read_nonblock_loop(io)
49
52
  else
50
- @try = 0
53
+ @tries = 0
51
54
  return got
52
55
  end
53
56
  end
@@ -55,7 +58,7 @@ module Halfshell
55
58
  end
56
59
 
57
60
  def too_many_tries?
58
- @try >= @limit
61
+ @tries >= @max_tries
59
62
  end
60
63
 
61
64
  def raise_error
@@ -1,3 +1,3 @@
1
1
  module Halfshell
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: halfshell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - andydna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-18 00:00:00.000000000 Z
11
+ date: 2020-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler