phantom 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: 1d30637c752f12133d0987930aa8be435bfae5cd
4
- data.tar.gz: 4fb139973bbdf6c990ee41f1cf736072fa91ac56
3
+ metadata.gz: d23e54afd7936bddad11560c655724526ade837c
4
+ data.tar.gz: 596f32e098dae1b9dc5f2fa386f8887a91257784
5
5
  SHA512:
6
- metadata.gz: dc63afdd0131f85c9369ba4e5d68cee2609f8e7a3bb1d3e6297dba98acabae0d279cf22c94ae8c3aaeb2a28f533c8c8f6c8a6a20c71a71de28511fb512dde51c
7
- data.tar.gz: 0749b36d7bf51dd79aaece8b255cd618a2aa86801c4e38af5d9247648656f40e3a50006c1f6069ba8b09d09142c012695a224e83cccd8824e3be3fe06f2fe236
6
+ metadata.gz: 005197660c0b984076ece07a3b4176e2f2ca028f2d923ba316025b1a09048b93a6eac1f857c93704eea0d05136ffe8b60aee316271a92390dc8d72771b299a51
7
+ data.tar.gz: 260787a370717231b31ec7d1c113e63eed032038ad03aa556459eaeab43277afaeba6abd97ccfd5671a23a2da3379e55695567ed85235f7d86ab97a823f89505
@@ -7,9 +7,13 @@ module Phantom
7
7
  raise ForkError.new('Running process exists.', pid_file) if pid_file and File.exist?(pid_file)
8
8
 
9
9
  i, o = IO.pipe
10
- f = File.new(pid_file, 'w') if pid_file
10
+ #f = File.new(pid_file, 'w') if pid_file
11
11
 
12
12
  pid = fork do
13
+ if pid_file
14
+ File.open(pid_file, 'w') {|f| f.write Process.pid}
15
+ end
16
+
13
17
  at_exit do
14
18
  o.flush
15
19
  o.close
@@ -26,8 +30,8 @@ module Phantom
26
30
  end
27
31
 
28
32
  Process.detach(pid)
29
- f.write(pid.to_s) if pid_file
30
- f.close if pid_file
33
+ #f.write(pid.to_s) if pid_file
34
+ #f.close if pid_file
31
35
  o.close
32
36
 
33
37
  Thread.abort_on_exception = true
@@ -1,3 +1,3 @@
1
1
  module Phantom
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -8,7 +8,12 @@ describe Phantom do
8
8
  end
9
9
 
10
10
  it 'should remove the pid file when normally ends.' do
11
- Phantom.run(pid_file: pid_file) {}
11
+ failed = false
12
+ Phantom.run(pid_file: pid_file, on_error: lambda{ failed = true }) {
13
+ raise 'PID file not found.' unless File.exists? pid_file
14
+ }
15
+ sleep 1
16
+ failed.should == false
12
17
  File.should_not exist(pid_file)
13
18
  end
14
19
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phantom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aetherus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-21 00:00:00.000000000 Z
11
+ date: 2013-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler