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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab5b3289d917f65a20d3085b48da1c9b5ba61bc42761d423e8029dab79a4e5bc
4
- data.tar.gz: e830c4eccf48efe7d77312e10acc7c7adcf394c38a31be298fb6f1d60516704d
3
+ metadata.gz: 0b18af4327ab4b82c67d859bac408f7b26488979f5dbde99e576095769a29dc5
4
+ data.tar.gz: 71be0d1633e12ad74ee1f8ca25859e3675cb135e710b76cb526b7019b644a5f0
5
5
  SHA512:
6
- metadata.gz: 16b28281b85a8cf84493d824ca826622391ee99dd91615c079ea08e656aa8a8b7b85ade2b4f09238f10577f3e30b85b235b0d555bbcec03a8d609e92cccb3abc
7
- data.tar.gz: 4f15d13b08fbd90bf08698c786c231f435eea479d976e81eeb3ce1da4c96c2d48c56a5f0cd006e63f88e76e77ab09737e565c72654a4c30f365f07b584d920da
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
@@ -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: they
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 #{owner(existing)} — pass --force to take it over"
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
- pid = pid.to_i
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Portless
4
- VERSION = "0.5.1.dev.20260826.0097222"
4
+ VERSION = "0.5.1"
5
5
  end
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.dev.20260826.0097222
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-26 00:00:00.000000000 Z
11
+ date: 2026-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async