unix_utils 0.0.8 → 0.0.9

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.
@@ -1,3 +1,9 @@
1
+ == 0.0.9 / 2012-04-12
2
+
3
+ * Bug fixes
4
+
5
+ * Correct implementation of :read_from
6
+
1
7
  == 0.0.8 / 2012-04-12
2
8
 
3
9
  * Bug fixes
@@ -285,7 +285,7 @@ module UnixUtils
285
285
  ready[1].each do |fd|
286
286
  begin
287
287
  boom = nil
288
- size = fd.write_nonblock(input.read(BUFSIZE))
288
+ size = fd.write(input.read(BUFSIZE))
289
289
  rescue ::Errno::EPIPE => boom
290
290
  rescue ::Errno::EAGAIN, ::Errno::EINTR
291
291
  end
@@ -1,3 +1,3 @@
1
1
  module UnixUtils
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -282,8 +282,8 @@ describe UnixUtils do
282
282
  describe :wc do
283
283
  before do
284
284
  @f = Tempfile.new('wc.txt')
285
- @f.write "dos line\r\n"*5_000
286
- @f.write "unix line\n"*5_000
285
+ @f.write "dos line\r\n"*50_000
286
+ @f.write "unix line\n"*50_000
287
287
  @f.flush
288
288
  @infile = @f.path
289
289
  end
@@ -291,7 +291,7 @@ describe UnixUtils do
291
291
  @f.close
292
292
  end
293
293
  it 'counts lines, words, and bytes' do
294
- UnixUtils.wc(@infile).must_equal [5_000+5_000, 10_000+10_000, 50_000+50_000]
294
+ UnixUtils.wc(@infile).must_equal [50_000+50_000, 100_000+100_000, 500_000+500_000]
295
295
  end
296
296
  end
297
297
 
@@ -419,4 +419,22 @@ describe UnixUtils do
419
419
  UnixUtils.tmp_path("dirname1/dirname2/basename.extname").wont_include 'dirname1'
420
420
  end
421
421
  end
422
+
423
+ # not really for public consumption
424
+ describe :spawn do
425
+ before do
426
+ @f = Tempfile.new('spawn.txt')
427
+ @f.write "dos line\r\n"*50_000
428
+ @f.write "unix line\n"*50_000
429
+ @f.flush
430
+ @infile = @f.path
431
+ end
432
+ after do
433
+ @f.close
434
+ end
435
+ it 'reads and writes everything' do
436
+ wc_output = UnixUtils.spawn(['wc'], :read_from => @infile)
437
+ wc_output.strip.split(/\s+/)[0..2].map { |s| s.to_i }.must_equal [50_000+50_000, 100_000+100_000, 500_000+500_000]
438
+ end
439
+ end
422
440
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unix_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: