phantom 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phantom/class_methods.rb +7 -3
- data/lib/phantom/version.rb +1 -1
- data/spec/phantom_spec.rb +6 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d23e54afd7936bddad11560c655724526ade837c
|
4
|
+
data.tar.gz: 596f32e098dae1b9dc5f2fa386f8887a91257784
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/phantom/version.rb
CHANGED
data/spec/phantom_spec.rb
CHANGED
@@ -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
|
-
|
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.
|
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-
|
11
|
+
date: 2013-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|