ruby-cli-daemon 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bdc9d0158a4c5bda15cffc7fd840f9fb19a78be1d808a7972f86526b99048ac6
4
- data.tar.gz: 80fd1f70317d0f821cfd000debbd165c180b8308e8fb55c84bbc2eaeed0bb714
3
+ metadata.gz: e7ecbd1e3b5a79a58076357cd42643f4c791dfde3d7c18863f907ceb82956e58
4
+ data.tar.gz: 8ae5d956213df23d0022ac8f8f57a6778fa3988fd9512565008e501f45bc4efd
5
5
  SHA512:
6
- metadata.gz: 84e6f69005593546caee47feafb734c73781c74a690c233f3287b686f5adc1c29d10a517079cd735c00551351b4f8e4d42e54bb068eb3cb8501ca443f7044ff8
7
- data.tar.gz: 814b27d01d61f5620846e7b52eb00f6d54bd1d9ce9a1d1cd66aa7e11eedb18e5c89543ca807f9a3def8a2f6ddb12b854a140a5cd2d72edace868a523ac175f8c
6
+ metadata.gz: 8305d8f10bc7dd72bab13cbfd371e877d7d80fa4e1451c8dcf68d1e0da47fb69698554981a34be57e2cb17326974748b69fbbf8a44c9ada7eaa45e57f0e87df4
7
+ data.tar.gz: 8719ebd454a9917ade205b17e2d1422e6fccac6c4264117e8a75235da1d8a674b6b6397ec8063d71fd5d38bba060e591baa9ac2729cb11e27fbce06de3c002d9
@@ -23,7 +23,7 @@ module RubyCliDaemon
23
23
  capture :STDOUT, "#{socket}.out" do
24
24
  capture :STDERR, "#{socket}.err" do
25
25
  _, status = Process.wait2(fork do
26
- ENV.replace env
26
+ ENV.replace env # uncovered
27
27
  ARGV.replace(command) # uncovered
28
28
  load path # uncovered
29
29
  end)
@@ -82,9 +82,14 @@ module RubyCliDaemon
82
82
 
83
83
  def wait_for_command(server)
84
84
  return unless IO.select([server], nil, nil, TIMEOUT)
85
+
85
86
  connection = server.accept
86
87
  command = connection.gets.shellsplit
87
- env = Hash[connection.read.split("--RCD-- ")[1..-1].map { |s| s.split(/ /, 2) }]
88
+
89
+ env = connection.read.split("--RCD-- ")
90
+ env.shift
91
+ env = Hash[env.map { |s| s.split(/ /, 2) }]
92
+
88
93
  connection.close
89
94
  [command, env]
90
95
  end
@@ -98,12 +103,11 @@ module RubyCliDaemon
98
103
  # https://grosser.it/2018/11/23/ruby-capture-stdout-without-stdout/
99
104
  def capture(stream, path)
100
105
  const = Object.const_get(stream)
106
+ const.sync = true
101
107
  old_stream = const.dup
102
- const.flush # not sure if that's necessary
103
108
  const.reopen(path)
104
109
  yield
105
110
  ensure
106
- const.flush # not sure if that's necessary
107
111
  const.reopen(old_stream)
108
112
  end
109
113
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module RubyCliDaemon
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-cli-daemon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-03 00:00:00.000000000 Z
11
+ date: 2019-06-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: michael@grosser.it