From 2adfb77cd86dafb71e590e5278447bf3278ac6d3 Mon Sep 17 00:00:00 2001 From: Steven Peters Date: Thu, 12 Apr 2018 22:35:51 -0700 Subject: [PATCH] missing: exit nonzero if missing deps are found --- Library/Homebrew/cmd/missing.rb | 3 +++ Library/Homebrew/test/cmd/missing_spec.rb | 4 ++-- docs/Manpage.md | 2 ++ manpages/brew.1 | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/missing.rb b/Library/Homebrew/cmd/missing.rb index 707ad68345..a12fd5460e 100644 --- a/Library/Homebrew/cmd/missing.rb +++ b/Library/Homebrew/cmd/missing.rb @@ -4,6 +4,8 @@ #: #: If `--hide=` is passed, act as if none of are installed. #: should be a comma-separated list of formulae. +#: +#: `missing` exits with a non-zero status if any formulae are missing dependencies. require "formula" require "tab" @@ -25,6 +27,7 @@ module Homebrew missing = f.missing_dependencies(hide: ARGV.values("hide")) next if missing.empty? + Homebrew.failed = true print "#{f}: " if ff.size > 1 puts missing.join(" ") end diff --git a/Library/Homebrew/test/cmd/missing_spec.rb b/Library/Homebrew/test/cmd/missing_spec.rb index f84dd66567..4c1b4367a8 100644 --- a/Library/Homebrew/test/cmd/missing_spec.rb +++ b/Library/Homebrew/test/cmd/missing_spec.rb @@ -14,7 +14,7 @@ describe "brew missing", :integration_test do expect { brew "missing" } .to output("foo\n").to_stdout .and not_to_output.to_stderr - .and be_a_success + .and be_a_failure end it "prints nothing if all dependencies are installed" do @@ -35,7 +35,7 @@ describe "brew missing", :integration_test do expect { brew "missing", "--hide=foo" } .to output("bar: foo\n").to_stdout .and not_to_output.to_stderr - .and be_a_success + .and be_a_failure end end end diff --git a/docs/Manpage.md b/docs/Manpage.md index 86ddff96fb..c9e080a4d2 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -340,6 +340,8 @@ With `--verbose` or `-v`, many commands print extra debugging information. Note If `--hide=``hidden` is passed, act as if none of `hidden` are installed. `hidden` should be a comma-separated list of formulae. + `missing` exits with a non-zero status if any formulae are missing dependencies. + * `options` [`--compact`] (`--all`|`--installed`|`formulae`): Display install options specific to `formulae`. diff --git a/manpages/brew.1 b/manpages/brew.1 index ba1f73cba6..eabec9430f 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -346,6 +346,9 @@ Check the given \fIformulae\fR for missing dependencies\. If no \fIformulae\fR a .IP If \fB\-\-hide=\fR\fIhidden\fR is passed, act as if none of \fIhidden\fR are installed\. \fIhidden\fR should be a comma\-separated list of formulae\. . +.IP +\fBmissing\fR exits with a non\-zero status if any formulae are missing dependencies\. +. .TP \fBoptions\fR [\fB\-\-compact\fR] (\fB\-\-all\fR|\fB\-\-installed\fR|\fIformulae\fR) Display install options specific to \fIformulae\fR\.