From 655e83c0bd0771a291cee1edabf5b3ba0ead0954 Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Sat, 4 Jan 2025 18:02:06 -0500 Subject: [PATCH] broot: run test on Linux --- Formula/b/broot.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Formula/b/broot.rb b/Formula/b/broot.rb index 0f2b755c71f58..c85cfadf088c6 100644 --- a/Formula/b/broot.rb +++ b/Formula/b/broot.rb @@ -43,22 +43,23 @@ def install end test do - return if OS.linux? && ENV["HOMEBREW_GITHUB_ACTIONS"] - output = shell_output("#{bin}/broot --help") assert_match "lets you explore file hierarchies with a tree-like view", output - assert_match version.to_s, shell_output("#{bin}/broot --version") require "pty" require "io/console" - PTY.spawn(bin/"broot", "-c", ":print_tree", "--color", "no", "--outcmd", testpath/"output.txt", - err: :out) do |r, w, pid| + PTY.spawn(bin/"broot", "-c", ":print_tree", "--color", "no", "--outcmd", testpath/"output.txt") do |r, w, pid| r.winsize = [20, 80] # broot dependency terminal requires width > 2 w.write "n\r" - assert_match "New Configuration files written in", r.read - Process.wait(pid) + output = "" + begin + r.each { |line| output += line } + rescue Errno::EIO + # GNU/Linux raises EIO when read is done on closed pty + end + assert_match "New Configuration files written in", output + assert_predicate Process::Status.wait(pid), :success? end - assert_equal 0, $CHILD_STATUS.exitstatus end end