Merge pull request #207020 from Homebrew/bump-qpdf-11.10.0
[Homebrew/homebrew-core.git] / Formula / e / empty.rb
bloba9fb4fb875a41abd67cc892835103c21011d31d3
1 class Empty < Formula
2   desc "Lightweight Expect-like PTY tool for shell scripts"
3   homepage "https://empty.sourceforge.net/"
4   url "https://downloads.sourceforge.net/project/empty/empty/empty-0.6.23c/empty-0.6.23c.tgz"
5   sha256 "8a7ca8c7099dc6d6743ac7eafc0be3b1f8991d2c8f20cf66ce900c7f08e010bd"
6   license "BSD-3-Clause"
8   livecheck do
9     url :stable
10     regex(%r{url=.*?/empty[._-]v?(\d+(?:\.\d+)+[a-z]?)\.t}i)
11   end
13   bottle do
14     sha256 cellar: :any_skip_relocation, arm64_sequoia:  "c189f046cac1c33a86463305d78c4a6b69233414cf539b9ec3b65a13c348b970"
15     sha256 cellar: :any_skip_relocation, arm64_sonoma:   "f0e6d00eaaefbe6a60857ff4a530fb8d28bc5f620ec8716d26c16071c2ecc5f4"
16     sha256 cellar: :any_skip_relocation, arm64_ventura:  "8b22f16579a729968596b00989f62625dd4c9bbcc80b087057f5cfd5d2ecffef"
17     sha256 cellar: :any_skip_relocation, arm64_monterey: "85ab1fd9a6ed43ce5d9ad0172d4fe9e62b1f52162e2b99ff7a60fd9d17007511"
18     sha256 cellar: :any_skip_relocation, arm64_big_sur:  "aed303027d0ffbeaa26261bc64f0ccc440d8765d38044dbdd5c9885aac4442a0"
19     sha256 cellar: :any_skip_relocation, sonoma:         "ba9e403002ccb197f4789d6a654214980010c94999133142c8f787dfaefccbaa"
20     sha256 cellar: :any_skip_relocation, ventura:        "3fb2717f273099d9011d8382c033afe8d6b7836dc2223b1ac3a301b683a0aea3"
21     sha256 cellar: :any_skip_relocation, monterey:       "6ba9bd7cdb7d47260f1c5dc600e93514c2222f7b3e5aab9a2ff5dbcadbf81d13"
22     sha256 cellar: :any_skip_relocation, big_sur:        "b8de713e95fe5ac8ffdb15ea679106b41ed858d70d7a96250b9694cfee4fb855"
23     sha256 cellar: :any_skip_relocation, x86_64_linux:   "6e3eeb73345dc8be3472ece5c28260e9592b6acf8cc6bb50abba43376cb10404"
24   end
26   def install
27     # Fix incorrect link order in Linux
28     inreplace "Makefile", "${LIBS} -o empty empty.c", "empty.c ${LIBS} -o empty" if OS.linux?
30     system "make", "all"
31     system "make", "PREFIX=#{prefix}", "install"
32     rm_r("#{prefix}/man")
33     man1.install "empty.1"
34     pkgshare.install "examples"
35   end
37   test do
38     require "pty"
40     # Looks like PTY must be attached for the process to be started
41     PTY.spawn(bin/"empty", "-f", "-i", "in", "-o", "out", "-p", "test.pid", "cat") { |_r, _w, pid| Process.wait(pid) }
42     system bin/"empty", "-s", "-o", "in", "Hello, world!\n"
43     assert_equal "Hello, world!\n", shell_output(bin/"empty -r -i out")
45     system bin/"empty", "-k", File.read(testpath/"test.pid")
46     sleep 1
47     %w[in out test.pid].each { |file| refute_predicate testpath/file, :exist? }
48   end
49 end