rb-portless 0.5.1.dev.20260826.0097222 → 0.5.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 +4 -4
- data/CHANGELOG.md +0 -13
- data/lib/portless/route_store.rb +3 -18
- data/lib/portless/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0b18af4327ab4b82c67d859bac408f7b26488979f5dbde99e576095769a29dc5
|
|
4
|
+
data.tar.gz: 71be0d1633e12ad74ee1f8ca25859e3675cb135e710b76cb526b7019b644a5f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4a22873edc19f846dbdc8937c5b7eaa281e033d49c7d6f5b4228aa668ecbb249bf34d4dd2a81f0a46a671369ffe0a539db18e551a7ae57e9bb5c952703de2168
|
|
7
|
+
data.tar.gz: a01760f31c79efbf03b8e6b79c260f1764c7fe6851a8d7b5c93bc7558a4956677dfeb064bb16ac05de6c23e2dabfbf1b18ce79d525e790afec6949f803d78484
|
data/CHANGELOG.md
CHANGED
|
@@ -4,19 +4,6 @@ All notable changes to this project are documented here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/), and the project adheres to
|
|
5
5
|
[Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
-
## [Unreleased]
|
|
8
|
-
|
|
9
|
-
### Fixed
|
|
10
|
-
|
|
11
|
-
- **`run --force` killed the run doing the forcing.** Taking over a hostname
|
|
12
|
-
held by a *static alias* passed its pid straight to `kill`, and an alias
|
|
13
|
-
records pid 0 — which to `kill(2)` means "every process in my group". So
|
|
14
|
-
`bin/dev --force` TERMed itself and its shell job, printing `Terminated: 15`
|
|
15
|
-
before the dev server ever started. An alias has no owner process to displace,
|
|
16
|
-
so force now just takes the hostname over, and `terminate` refuses any pid
|
|
17
|
-
that isn't a real process. The conflict message you get *without* `--force`
|
|
18
|
-
now says "a static alias" instead of the unlookuppable "pid 0".
|
|
19
|
-
|
|
20
7
|
## [0.5.1]
|
|
21
8
|
|
|
22
9
|
### Security
|
data/lib/portless/route_store.rb
CHANGED
|
@@ -45,9 +45,7 @@ module Portless
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
# Register (or replace) a route. Conflicts with a *live* different owner raise
|
|
48
|
-
# unless force, which SIGTERMs the incumbent. Alias routes use pid 0
|
|
49
|
-
# count as live (never reaped) but have no process, so force just takes the
|
|
50
|
-
# hostname over. Public
|
|
48
|
+
# unless force, which SIGTERMs the incumbent. Alias routes use pid 0. Public
|
|
51
49
|
# share URLs (tailscale/ngrok), when present, are recorded so `list` can show
|
|
52
50
|
# them while the run is active.
|
|
53
51
|
def add(hostname:, port:, pid:, force: false, tailscale: nil, ngrok: nil, lan: false)
|
|
@@ -57,7 +55,7 @@ module Portless
|
|
|
57
55
|
if existing && existing["pid"].to_i != pid.to_i && !dead?(existing["pid"])
|
|
58
56
|
unless force
|
|
59
57
|
raise RouteConflictError,
|
|
60
|
-
"#{hostname} is already served by #{
|
|
58
|
+
"#{hostname} is already served by pid #{existing['pid']} — pass --force to take it over"
|
|
61
59
|
end
|
|
62
60
|
terminate(existing["pid"])
|
|
63
61
|
end
|
|
@@ -156,21 +154,8 @@ module Portless
|
|
|
156
154
|
true # exists, owned by someone else (e.g. root proxy)
|
|
157
155
|
end
|
|
158
156
|
|
|
159
|
-
# Who to blame in a conflict message. An alias has no process behind it, so
|
|
160
|
-
# "pid 0" would be nonsense to read and impossible to go look up.
|
|
161
|
-
def owner(route)
|
|
162
|
-
route["pid"].to_i.zero? ? "a static alias" : "pid #{route['pid']}"
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
# Displace the route's current owner. Only a real pid gets signalled: 0 means
|
|
166
|
-
# "my whole process group" and a negative one means "that group", so passing
|
|
167
|
-
# an alias route straight through would TERM the very run asking for the
|
|
168
|
-
# takeover (and its shell job with it) instead of the incumbent.
|
|
169
157
|
def terminate(pid)
|
|
170
|
-
|
|
171
|
-
return unless pid.positive?
|
|
172
|
-
|
|
173
|
-
Process.kill("TERM", pid)
|
|
158
|
+
Process.kill("TERM", pid.to_i)
|
|
174
159
|
rescue StandardError
|
|
175
160
|
nil
|
|
176
161
|
end
|
data/lib/portless/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rb-portless
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.1
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Afonso
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-08-
|
|
11
|
+
date: 2026-08-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: async
|