rundoc 1.1.0 → 1.1.1

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: da3a985092d1a4964518696470e3caffbccfa38fb4c77babd3bb9db3019574f8
4
- data.tar.gz: b10a337ee209e1b915b2bbd806c5e20a39919bb4768e015f3cd3b9ced7690608
3
+ metadata.gz: 0e767697a50da725490c5a2af1dd2a8ef894c9fa79e8260230ec2a41000ffefa
4
+ data.tar.gz: b682ac2f59204b1a62edd00f46817c27a63c58a95c87fd312803d42a6dd7b668
5
5
  SHA512:
6
- metadata.gz: 67f0fc97aabfb49844520018ec31b94ffa9d99472115a1c4d32f19a9f4d352c2474e5b3120769000322b042fb7ac8ea302170c0fc6632e178f2760b1d4ef6ae3
7
- data.tar.gz: 04bf8538b5087638a5ff731154ea5c5c3c189bd8ea321d0d2b7690acb604e4a7120dd1adf0f9566fe91c225b9a7e0a634cb642de16e0919c3fedf43e893c12b6
6
+ metadata.gz: cee0548716aa1cd4bb14f1eb21541dc010f5d8c706de49240b9e3245d847fbdfc08c34858a5ba7755d45d091671f3c712bd02a4d91e561927cae3b114780fd7f
7
+ data.tar.gz: aa340da522f964e0daeb3e7fd3b03bb340ecbe062a18c456474f00392ce660d0f28afdf427c99812013d4765b362e1bc11d1585330c8653118d1b8d0edd97d76
@@ -1,5 +1,9 @@
1
1
  ## master
2
2
 
3
+ ## 1.1.1
4
+
5
+ - Fix log read race condition (https://github.com/schneems/rundoc/pull/25)
6
+
3
7
  ## 1.1.0
4
8
 
5
9
  - Pipe logic is now implemented through a parser (https://github.com/schneems/rundoc/pull/22)
@@ -48,9 +48,9 @@ class Rundoc::CodeCommand::Background
48
48
  def initialize(command , timeout: 5, log: Tempfile.new("log"), out: "2>&1")
49
49
  @command = command
50
50
  @timeout_value = timeout
51
- @log = log
51
+ @log_reference = log # https://twitter.com/schneems/status/1285289971083907075
52
52
 
53
- @log = Pathname.new(@log)
53
+ @log = Pathname.new(log)
54
54
  @log.dirname.mkpath
55
55
  FileUtils.touch(@log)
56
56
 
@@ -26,9 +26,6 @@ class Rundoc::CodeCommand::Background
26
26
  @spawn.wait(@wait)
27
27
  @spawn.check_alive! unless @allow_fail
28
28
 
29
- # WTF BBQ SAUCE
30
- FileUtils.touch(@spawn.log)
31
-
32
29
  @spawn.log.read
33
30
  end
34
31
 
@@ -1,3 +1,3 @@
1
1
  module Rundoc
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -1,6 +1,32 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class BackgroundTest < Minitest::Test
4
+ def test_process_spawn_gc
5
+ Dir.mktmpdir do |dir|
6
+ Dir.chdir(dir) do
7
+ file = "foo.txt"
8
+ `echo 'foo' >> #{file}`
9
+
10
+ background_start = Rundoc::CodeCommand::Background::Start.new("tail -f #{file}",
11
+ name: "tail2",
12
+ wait: "f"
13
+ )
14
+
15
+ GC.start
16
+
17
+ output = background_start.call
18
+
19
+ assert_match("foo", output)
20
+ assert_equal(true, background_start.alive?)
21
+
22
+ background_stop = Rundoc::CodeCommand::Background::Stop.new(name: "tail2")
23
+ background_stop.call
24
+
25
+ assert_equal(false, background_start.alive?)
26
+ end
27
+ end
28
+ end
29
+
4
30
  def test_background_start
5
31
  Dir.mktmpdir do |dir|
6
32
  Dir.chdir(dir) do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rundoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Schneeman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-19 00:00:00.000000000 Z
11
+ date: 2020-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor