by 1.0.0 → 1.0.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: '078f15faf5964b6b3bb4ac860c7733e069c0a8cb46556e9af7e555f8c3808d54'
4
- data.tar.gz: e878d37b2417d4d655f138d3e2bae5bf51a76c34b7a3fab2956bc40c88a77dbb
3
+ metadata.gz: 24eb5316c698a47210046042dac2cd9912b3517fc88e88b0efed5da5f35d1fde
4
+ data.tar.gz: 77da0597a3214bdec5d90cc8fd5bcb5b746b7dfc606b80f2460f338ddbb3fbed
5
5
  SHA512:
6
- metadata.gz: 128a3c27c4dfe729b62fa15d9b961f7384a75ec02030403ae85b376981b731c8d892305732e519cbfb84ab105b816275e6a910afff7f9187c2f723d7683eb12d
7
- data.tar.gz: 61895959cd9a6097ded3430017d0a831affa73c668c8301579dd4a62f661a6c1fd3bb09871d5eb321ce9d97fb7a64c573fc8b92a60ae34b7adfcad835eb0ae08
6
+ metadata.gz: 65774c8520ea887f2cd0c11bfe71787ef39a00441648170b03b09825267a248443c5678ba8371a4d58963a557d60b150d77c06aad1cbf88fa5e7ba27357af28d
7
+ data.tar.gz: 84a86908dd443d71cb42a1150856df38f571ed6f199d9aedeee7bbc6f6dc738d7e0910339ec6151fa3202fc3e98c5b4c6339eb808d70b39daf8d73d16884fe68
data/CHANGELOG CHANGED
@@ -1,3 +1,11 @@
1
+ === 1.0.1 (2023-02-09)
2
+
3
+ * Make by-server stop more reliable by using SIGKILL if server does not stop with SIGQUIT (jeremyevans)
4
+
5
+ * Remove debugging code when running a single file with minitest autorun (jeremyevans)
6
+
7
+ * Use RbConfig.ruby to get the ruby binary name (eregon) (#1)
8
+
1
9
  === 1.0.0 (2023-02-07)
2
10
 
3
11
  * Initial Public Release
data/README.rdoc CHANGED
@@ -65,8 +65,7 @@ needs the +socket+ standard library. The only issue with that is that
65
65
 
66
66
  require 'rbconfig'
67
67
  by = Gem.activate_bin_path("by", "by")
68
- ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['RUBY_INSTALL_NAME'])
69
- puts "alias by='#{ruby} --disable-gems #{by}'"
68
+ puts "alias by='#{RbConfig.ruby} --disable-gems #{by}'"
70
69
 
71
70
  Note that one issue with using a shell alias is that it only
72
71
  works when loaded and used by the shell, it won't work if
@@ -88,8 +87,7 @@ needs the +socket+ standard library. The only issue with that is that
88
87
 
89
88
  require 'rbconfig'
90
89
  by = Gem.activate_bin_path("by", "by")
91
- ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['RUBY_INSTALL_NAME'])
92
- File.binwrite("by", "#!/bin/sh\nexec #{ruby} --disable-gems #{by} \"$@\"\n")
90
+ File.binwrite("by", "#!/bin/sh\nexec #{RbConfig.ruby} --disable-gems #{by} \"$@\"\n")
93
91
  File.chmod(0755, "by")
94
92
 
95
93
  With each of these approaches, you can get much faster program
data/bin/by-session CHANGED
@@ -4,7 +4,7 @@
4
4
  require 'rbconfig'
5
5
  ENV['BY_SOCKET'] ||= File.join(Dir.pwd, '.by_socket')
6
6
  by_server = File.join(__dir__, 'by-server')
7
- ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['RUBY_INSTALL_NAME'])
7
+ ruby = RbConfig.ruby
8
8
 
9
9
  begin
10
10
  system(ruby, by_server, *ARGV, exception: true)
data/lib/by/server.rb CHANGED
@@ -89,7 +89,7 @@ module By
89
89
  end
90
90
 
91
91
  # Handle an existing server socket. This attempts to connect to the socket and
92
- # then shutdown the server. If successful, it removes the socket. If unnecessful,
92
+ # then shutdown the server. If successful, it removes the socket. If unsuccessful,
93
93
  # it will print an error.
94
94
  def handle_existing_server
95
95
  if File.socket?(@socket_path)
data/lib/by/worker.rb CHANGED
@@ -48,7 +48,28 @@ module By
48
48
 
49
49
  # Stop the server process by sending it the SIGQUIT signal, then exit.
50
50
  def stop_server
51
- Process.kill(:QUIT, Process.ppid)
51
+ i = 0
52
+ while Process.ppid != 1 && Process.kill(0, Process.ppid)
53
+ if i < 4
54
+ Process.kill(:QUIT, Process.ppid)
55
+ end
56
+ sleep 0.1
57
+
58
+ if i == 5
59
+ # This is only reached if the QUIT signal does not
60
+ # cause the process to exit.
61
+ Process.kill(:KILL, Process.ppid)
62
+ end
63
+ if i > 8
64
+ # This is only reached if the process has still not
65
+ # stopped even after the KILL signal was sent.
66
+ $stderr.puts "ERROR: cannot stop by-server"
67
+ @normal_exit = false
68
+ break
69
+ end
70
+
71
+ i += 1
72
+ end
52
73
  cleanup_proc.call
53
74
  exit
54
75
  end
@@ -146,7 +167,7 @@ module By
146
167
  if defined?(Minitest) && Minitest.class_variable_get(:@@installed_at_exit)
147
168
  Minitest.singleton_class.prepend(Module.new do
148
169
  define_method(:run) do |argv|
149
- super(argv).tap{|exit_code| p worker.normal_exit = exit_code == true}
170
+ super(argv).tap{|exit_code| worker.normal_exit = exit_code == true}
150
171
  end
151
172
  end)
152
173
  Minitest.after_run(&cleanup)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: by
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-07 00:00:00.000000000 Z
11
+ date: 2023-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest-global_expectations