Skip to content

Commit 9cbbdfb

Browse files
authored
Merge pull request Homebrew#225369 from ivancasco/lume-add-service-improve-test
lume: add service, improve test PID handling
2 parents e83342f + 09e1b7e commit 9cbbdfb

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

Formula/l/lume.rb

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ class Lume < Formula
1212
end
1313

1414
bottle do
15-
sha256 cellar: :any_skip_relocation, arm64_sequoia: "24daf74bc4a40c20664689c07289628f95e28b6f809d291ebf9d064a7d140abe"
16-
sha256 cellar: :any_skip_relocation, arm64_sonoma: "20eb306a5ac5f378fa4a2c3686941ef3ca418105be222e653e0ea28fc0d25330"
15+
rebuild 1
16+
sha256 cellar: :any_skip_relocation, arm64_sequoia: "77bb23d3c58147d030d07d5548d81c3d54e79d5b39158daf5bb74098e26e78ed"
17+
sha256 cellar: :any_skip_relocation, arm64_sonoma: "84bb13d84c4fd64cb8c818158f9ebbb955c2b6b196c7b2bb887c9bc4994ffda6"
1718
end
1819

1920
depends_on xcode: ["16.0", :build]
@@ -30,15 +31,27 @@ def install
3031
end
3132
end
3233

34+
service do
35+
run [opt_bin/"lume", "serve"]
36+
keep_alive true
37+
working_dir var
38+
log_path var/"log/lume.log"
39+
error_log_path var/"log/lume.log"
40+
end
41+
3342
test do
3443
# Test ipsw command
3544
assert_match "Found latest IPSW URL", shell_output("#{bin}/lume ipsw")
3645

3746
# Test management HTTP server
38-
# Serves 404 Not found if no machines created
3947
port = free_port
40-
fork { exec bin/"lume", "serve", "--port", port.to_s }
48+
pid = spawn bin/"lume", "serve", "--port", port.to_s
4149
sleep 5
42-
assert_match %r{^HTTP/\d(.\d)? (200|404)}, shell_output("curl -si localhost:#{port}/lume").lines.first
50+
begin
51+
# Serves 404 Not found if no machines created
52+
assert_match %r{^HTTP/\d(.\d)? (200|404)}, shell_output("curl -si localhost:#{port}/lume").lines.first
53+
ensure
54+
Process.kill "SIGTERM", pid
55+
end
4356
end
4457
end

0 commit comments

Comments
 (0)