Commit 4105015
committed
Fix reloading in Ruby 3.3
This commit ensures the application is restarted when a preloaded file
is changed. This has been silently broken because the fallback behavior
still results in the application being restarted, but only when the user
next runs a command—hence the acceptance test still passing.
The behavior of `BasicSocket#recv` changed in Ruby 3.3 [1] such that it
now returns `nil` on a closed stream socket, instead of an empty string.
When we call `#empty?` on `nil` the `NoMethodError` is swallowed by the
failsafe thread and the application is not restarted.
This commit fixes the issue by checking both `#nil?` and `#empty?` so it
works with both old and new versions. It also updates the acceptance
test to be more specific about what it considers a "reload" by
asserting the relevant log line exists.
[1]: ruby/ruby#64071 parent eefc42d commit 4105015
File tree
3 files changed
+5
-2
lines changed- lib/spring
- test/support
3 files changed
+5
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
| 130 | + | |
130 | 131 | | |
131 | 132 | | |
132 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| |||
0 commit comments