ztk 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ztk/command.rb +7 -3
- data/lib/ztk/version.rb +1 -1
- metadata +3 -3
data/lib/ztk/command.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'ostruct'
|
2
2
|
require 'timeout'
|
3
3
|
require 'childprocess'
|
4
|
+
require 'socket'
|
4
5
|
|
5
6
|
module ZTK
|
6
7
|
|
@@ -117,7 +118,11 @@ module ZTK
|
|
117
118
|
loop do
|
118
119
|
reader_writer_map.keys.each do |pipe|
|
119
120
|
data = (pipe.readpartial(1024) rescue nil)
|
120
|
-
|
121
|
+
|
122
|
+
if (data.nil? || data.empty?)
|
123
|
+
sleep(0.1)
|
124
|
+
next
|
125
|
+
end
|
121
126
|
|
122
127
|
case reader_writer_key[pipe]
|
123
128
|
when :stdout then
|
@@ -142,7 +147,6 @@ module ZTK
|
|
142
147
|
output += data
|
143
148
|
end
|
144
149
|
break if reader_writer_map.keys.all?{ |reader| reader.eof? }
|
145
|
-
sleep(0.1)
|
146
150
|
end
|
147
151
|
end
|
148
152
|
rescue Timeout::Error => e
|
@@ -184,7 +188,7 @@ module ZTK
|
|
184
188
|
# Returns a string in the format of "user@hostname" for the current
|
185
189
|
# shell.
|
186
190
|
def tag
|
187
|
-
@@hostname ||=
|
191
|
+
@@hostname ||= Socket.gethostname.split('.').first.strip
|
188
192
|
"#{ENV['USER']}@#{@@hostname}"
|
189
193
|
end
|
190
194
|
|
data/lib/ztk/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ztk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -281,7 +281,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
281
281
|
version: '0'
|
282
282
|
segments:
|
283
283
|
- 0
|
284
|
-
hash:
|
284
|
+
hash: 1328731926470654880
|
285
285
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
286
286
|
none: false
|
287
287
|
requirements:
|
@@ -290,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
290
290
|
version: '0'
|
291
291
|
segments:
|
292
292
|
- 0
|
293
|
-
hash:
|
293
|
+
hash: 1328731926470654880
|
294
294
|
requirements: []
|
295
295
|
rubyforge_project:
|
296
296
|
rubygems_version: 1.8.25
|