From 7a18388506fa2b841febb5a8cd68bf79319ad104 Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Thu, 9 Jan 2025 11:23:38 -0500 Subject: [PATCH] heksa: update test --- Formula/h/heksa.rb | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/Formula/h/heksa.rb b/Formula/h/heksa.rb index 247071c35bc1e..6a6afafec9c9e 100644 --- a/Formula/h/heksa.rb +++ b/Formula/h/heksa.rb @@ -32,17 +32,11 @@ def install test do require "pty" - r, _w, pid = PTY.spawn("#{bin}/heksa -l 16 -f asc -o no #{test_fixtures("test.png")}") - - # remove ANSI colors - begin - output = r.read.gsub(/\e\[([;\d]+)?m/, "") + PTY.spawn("#{bin}/heksa -l 16 -f asc -o no #{test_fixtures("test.png")}") do |r, _w, pid| + output = r.readline.gsub(/\e\[([;\d]+)?m/, "") assert_match(/^.PNG/, output) - rescue Errno::EIO - # GNU/Linux raises EIO when read is done on closed pty + ensure + Process.wait pid end - - Process.wait(pid) - assert_equal 0, $CHILD_STATUS.exitstatus end end