sails 0.1.2 → 0.1.3

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: fdca82274162d55762d2eddeb183930b7e0b77a5
4
- data.tar.gz: 6008de27f43aed4eec5c4d2935abb318a5e64f46
3
+ metadata.gz: 2e74e7c5aa4367c6ff007908da99902fd191e3d5
4
+ data.tar.gz: 3c0809e759597d4d24e9a11d954955f470d80d45
5
5
  SHA512:
6
- metadata.gz: 0a8a8dedb82895595fa18613dd058ed6c4f91f8db83cd10d8e3a02a51d85c3490c5a364d38cfa1c8f1ed55c7dd2535763b593223c61bd62d54d092a6758cba53
7
- data.tar.gz: e7ee9fd640638548ed95a81a65bf1443c84fb09531d74c8cf70397f233e022979d4b4c16780400491a2885e900c14eec7f7944b6fc23d27607798f561f8d93c8
6
+ metadata.gz: c8bd636249f59c425071153d49efc3820362af838065ba647f5677928fb6cf69f7a3954358679336ddf94e01c5e31be6583a9092654b62b727e29c39f20b87b8
7
+ data.tar.gz: 902bdd6d4b2827e082ab333e4c0d0c0c6523992be83717141e68f3080d6897bddb1b23077ccc4ccbf7e1bfd16ac714da0b59ab9088849bf778d3bb5d375acb03
@@ -1,3 +1,7 @@
1
+ ## 0.1.3 / 2014-12-22
2
+
3
+ - Fix zombie process on restart in some Linux systems.
4
+
1
5
  ## 0.1.2 / 2014-12-17
2
6
 
3
7
  - `sails restart` use kill -USR2 signal, not kill master process.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sails (0.1.1)
4
+ sails (0.1.2)
5
5
  activesupport (>= 3.2.0)
6
6
  thor
7
7
  thrift (>= 0.9.0)
@@ -19,7 +19,7 @@ GEM
19
19
  diff-lcs (1.2.5)
20
20
  i18n (0.6.11)
21
21
  json (1.8.1)
22
- minitest (5.4.3)
22
+ minitest (5.5.0)
23
23
  rspec (3.1.0)
24
24
  rspec-core (~> 3.1.0)
25
25
  rspec-expectations (~> 3.1.0)
@@ -44,6 +44,8 @@ module Sails
44
44
  log_file = Sails.root.join("log/#{Sails.env}.log")
45
45
  system "tail -f #{log_file}"
46
46
  Process.waitpid(@master_pid)
47
+ else
48
+ exit
47
49
  end
48
50
  end
49
51
 
@@ -59,7 +61,7 @@ module Sails
59
61
 
60
62
  def fork_master_process!
61
63
  fork do
62
- $PROGRAM_NAME = self.app_name + " [master]"
64
+ $PROGRAM_NAME = self.app_name + " [sails master]"
63
65
  @child_pid = fork_child_process!
64
66
 
65
67
  Signal.trap("QUIT") {
@@ -68,8 +70,7 @@ module Sails
68
70
  }
69
71
 
70
72
  Signal.trap("USR2") {
71
- puts @child_pid.inspect
72
- Process.kill("QUIT", @child_pid)
73
+ Process.kill("USR2", @child_pid)
73
74
  }
74
75
 
75
76
  loop do
@@ -77,7 +78,6 @@ module Sails
77
78
  begin
78
79
  Process.getpgid(@child_pid)
79
80
  rescue Errno::ESRCH => e
80
- # puts "Child not found, will restart..."
81
81
  @child_pid = fork_child_process!
82
82
  end
83
83
  end
@@ -85,15 +85,21 @@ module Sails
85
85
  end
86
86
 
87
87
  def fork_child_process!
88
- fork do
89
- $PROGRAM_NAME = self.app_name
90
- Sails.start!(self.mode)
91
-
88
+ pid = fork do
89
+ $PROGRAM_NAME = self.app_name + " [sails child]"
90
+ Signal.trap("QUIT") {
91
+ exit
92
+ }
93
+
92
94
  Signal.trap("USR2") {
93
95
  # TODO: reload Sails in current process
94
96
  exit
95
97
  }
98
+ Sails.start!(self.mode)
96
99
  end
100
+ # http://ruby-doc.org/core-1.9.3/Process.html#detach-method
101
+ Process.detach(pid)
102
+ return pid
97
103
  end
98
104
 
99
105
  def stop_process
@@ -50,7 +50,6 @@ module Sails
50
50
  status = "Failed #{e.try(:code)}"
51
51
  raise e
52
52
  rescue => e
53
- puts "------- #{e.inspect}"
54
53
  if defined?(ActiveRecord) && e.is_a?(ActiveRecord::RecordNotFound)
55
54
  status = "Not Found"
56
55
  code = 404
@@ -1,5 +1,5 @@
1
1
  module Sails
2
2
  def self.version
3
- "0.1.2"
3
+ "0.1.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Lee
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-12-17 00:00:00.000000000 Z
15
+ date: 2014-12-22 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport