relaunch 0.15.0 → 0.16.0

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: 72b9d31380594b154a7da4a467e47f6e4fc555af0b7cfb5a71d1f45bcf3bd2c5
4
- data.tar.gz: b83f6350d7302b369939fc1afb2a8fb3fbea729fb149d1e135f945edb0a26ccb
3
+ metadata.gz: b82966b5c2f6770cbe54fa75491aea07e93b748675b1addc9c199bce27726a83
4
+ data.tar.gz: 54208d5f0a33f47e20e8e18e443038180263197e8e7d1cf4aa15a90704e4b674
5
5
  SHA512:
6
- metadata.gz: 9d12530b843c2624a7b789af56cf998644aa54ed0487d08eeb7a847966d616c3c39608ee51e7a3458a2be561ce24df7794815c9a0f5759be2ec7257c2341d6f4
7
- data.tar.gz: e777eb25ab636c8dd165877632d4a3e1e71d97ccc00ed99fd19c6444e4142e28619b1f9d21ce404efb85072a90737ec88ddd4565930a5f4d2fc0f43a09e3a9e9
6
+ metadata.gz: 94a29158b46f63ad14222bb8618f794134c3711320c89d8081183c1d9299e4153d52fedd3538a77cc5ad0d17351807cff690fd7c247f9ef97874c117706db322
7
+ data.tar.gz: d64f7e8adbefe1be146c54ee61cecdc666b06fff0c36340af5243aa207994e3a64a9de03970c4cd7d74a7402f23d5dcdbd47aa9ba33bfeda5e9f4e7e77e3195c
data/Changelog.md CHANGED
@@ -1,15 +1,32 @@
1
1
  # Changelog
2
2
 
3
- ## 0.15.0 (unreleased)
3
+ ## 0.16.0
4
+
5
+ - Fix an intermittent crash when restarting a command with `--exit` by
6
+ sharing the child's exit-status waiter between startup and shutdown.
7
+ ([#4](https://github.com/spinels/relaunch/pull/4))
8
+
9
+ - Enable keyboard controls only when standard input is a terminal and, on
10
+ Unix, the runner is in its foreground process group. This avoids stops
11
+ under supervisors such as Overman and `stty` warnings with redirected
12
+ input while preserving file watching and automatic restarts.
13
+ ([#3](https://github.com/spinels/relaunch/pull/3))
14
+
15
+ ## 0.15.0
4
16
 
5
17
  - Require Ruby 3.3 or newer.
18
+ ([29a07e1](https://github.com/spinels/relaunch/commit/29a07e19033f828720d5b563e98df09ca5c054dd))
6
19
  - Publish as `relaunch`, preserving the `rerun` command, `.rerun`
7
20
  configuration, and `Rerun` namespace.
21
+ ([b1f9165](https://github.com/spinels/relaunch/commit/b1f91653f800e53f9cd421f844a8dc7d9c366839))
8
22
  - Add `relaunch` as a command alias and `require "relaunch"` as an entry
9
23
  point to the existing library.
24
+ ([b1f9165](https://github.com/spinels/relaunch/commit/b1f91653f800e53f9cd421f844a8dc7d9c366839))
10
25
  - Support Ruby 4.0 keyboard input using upstream's `IO#wait_readable` fix.
26
+ ([b00ffc6](https://github.com/alexch/rerun/commit/b00ffc6fb7e2c9da676a672200678da0154a60a1))
11
27
  - Raise `Rerun::ExitException` when the runner exits so library callers can
12
28
  handle shutdown. The command continues to exit successfully.
29
+ ([072c356](https://github.com/spinels/relaunch/commit/072c3561fd1581ac2c954c239202e755265de7e2))
13
30
 
14
31
  Earlier Rerun releases are documented in the
15
32
  [upstream version history](README.md#version-history).
data/Fork.md CHANGED
@@ -3,6 +3,25 @@
3
3
  Relaunch is a fork of [alexch/rerun](https://github.com/alexch/rerun).
4
4
  Functional changes are listed newest first.
5
5
 
6
+ ## September 13, 2026: Preserve exit status during restart
7
+
8
+ Fix [#1](https://github.com/spinels/relaunch/issues/1), an intermittent
9
+ `undefined method 'success?' for nil` crash when restarting with `--exit`.
10
+ Shutdown now waits for the existing detached process waiter instead of
11
+ collecting the child's status with a competing `Process.wait` call.
12
+
13
+ ## September 13, 2026: Require a foreground terminal for keyboard controls
14
+
15
+ [a4d833e](https://github.com/spinels/relaunch/commit/a4d833e11ce32caf96dde784e9a65950f5df76c2)
16
+ enables keyboard controls only when standard input is a terminal and, on
17
+ Unix, the runner belongs to its foreground process group. This prevents
18
+ terminal access from stopping background process groups under supervisors
19
+ such as Overman and avoids repeated `stty` warnings with redirected input.
20
+
21
+ File watching and automatic restarts remain enabled when keyboard controls
22
+ are unavailable. The `--background` option still disables keyboard controls
23
+ explicitly.
24
+
6
25
  ## September 13, 2026: Minimum Ruby version
7
26
 
8
27
  Relaunch requires Ruby 3.3 or newer.
data/README.md CHANGED
@@ -252,8 +252,12 @@ While the app is (re)running, you can make things happen by pressing keys:
252
252
  * **x** or **q** -- exit (just like control-C)
253
253
  * **p** -- pause/unpause filesystem watching
254
254
 
255
- If you're backgrounding or using Pry or a debugger, you might not want these
256
- keys to be trapped, so use the `--background` option.
255
+ Keyboard commands are enabled only when standard input is a terminal and,
256
+ on Unix, rerun belongs to its foreground process group. File watching and
257
+ automatic restarts remain enabled when keyboard commands are unavailable.
258
+
259
+ Use `--background` to disable keyboard commands explicitly, for example when
260
+ using Pry or a debugger.
257
261
 
258
262
  # Signals
259
263
 
@@ -369,10 +373,9 @@ of Ruby nor config file syntax.
369
373
 
370
374
  ## Development
371
375
 
372
- Set up the test dependencies, install the bundle, and run the specs:
376
+ Install the bundle and run the specs:
373
377
 
374
378
  ```sh
375
- ./bin/setup-deps
376
379
  bundle install
377
380
  bundle exec rake spec
378
381
  ```
data/lib/rerun/runner.rb CHANGED
@@ -26,7 +26,7 @@ module Rerun
26
26
  end
27
27
 
28
28
  def start_keypress_thread
29
- return if @options[:background]
29
+ return if @options[:background] || !interactive_terminal?
30
30
 
31
31
  @keypress_thread = Thread.new do
32
32
  while true
@@ -163,7 +163,7 @@ module Rerun
163
163
  raise ExitException
164
164
  end
165
165
 
166
- status_thread = Process.detach(@pid) # so if the child exits, it dies
166
+ status_thread = @status_thread = Process.detach(@pid)
167
167
 
168
168
  Signal.trap("INT") do # INT = control-C -- allows user to stop the top-level rerun process
169
169
  die
@@ -250,6 +250,7 @@ module Rerun
250
250
  # @returns true if the process dies
251
251
  # @returns false if either sending the signal fails or the process fails to die
252
252
  def signal_and_wait(signal)
253
+ status_thread = @status_thread
253
254
 
254
255
  signal_sent = if windows?
255
256
  force_kill = (signal == 'KILL')
@@ -262,9 +263,9 @@ module Rerun
262
263
  # the signal was successfully sent, so wait for the process to die
263
264
  begin
264
265
  timeout(@options[:wait]) do
265
- Process.wait(@pid)
266
+ status_thread.join
266
267
  end
267
- process_status = $?
268
+ process_status = status_thread.value
268
269
  say "Process ended: #{process_status}" if verbose?
269
270
  true
270
271
  rescue Timeout::Error
@@ -362,6 +363,20 @@ module Rerun
362
363
  end
363
364
 
364
365
  private
366
+
367
+ def interactive_terminal?
368
+ return false unless $stdin.tty?
369
+ return true if windows?
370
+
371
+ # A terminal can be inherited by a background group (e.g. under Overman).
372
+ # Querying ps avoids platform-specific terminal ioctl constants.
373
+ foreground_group = IO.popen(['ps', '-o', 'tpgid=', '-p', Process.pid.to_s],
374
+ err: File::NULL, &:read).to_i
375
+ foreground_group == Process.getpgrp
376
+ rescue IOError, SystemCallError
377
+ false
378
+ end
379
+
365
380
  def one_char
366
381
  c = nil
367
382
  msg = $stdin.respond_to?(:wait_readable) ? :wait_readable : :ready?
data/relaunch.gemspec CHANGED
@@ -3,7 +3,7 @@ $spec = Gem::Specification.new do |s|
3
3
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
4
4
 
5
5
  s.name = 'relaunch'
6
- s.version = '0.15.0'
6
+ s.version = '0.16.0'
7
7
  s.required_ruby_version = '>= 3.3'
8
8
 
9
9
  s.description = "Restarts your app when a file changes. A no-frills, command-line alternative to Guard, Shotgun, Autotest, etc."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaunch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Chaffee