57 Commits
Author SHA1 Message Date
Caleb Xu 227b8148eb system_command: redact secrets in stdout/stderr
We already redact secrets when printing the command-line invocation
itself. Make sure that stdout/stderr doesn't leak secrets either.
2021-11-10 10:36:16 -05:00
Bo Anderson d83b8002ef system_command: better handle race conditions when interrupting 2021-05-11 13:44:32 +01:00
Bo Anderson aea107b55a system_command: fix rare scenario of interrupt being reported to stderr 2021-05-11 02:32:29 +01:00
Bo Anderson 6c10adab2f system_command: avoid waiting on pipes after process termination 2021-05-10 15:48:15 +01:00
Markus Reiter 06a5811b4b Simplify and fix each_line_from. 2021-04-03 20:10:33 +02:00
Markus Reiter 59f4a711cd Deprecate _fetch without timeout option. 2021-04-03 20:10:33 +02:00
Markus Reiter 24c9b599a6 Revert "Revert "Merge pull request #10864 from reitermarkus/command-timeout""
This reverts commit 57b2660cae.
2021-04-03 20:10:32 +02:00
Bo Anderson e30f2af987 system_command: improve EOF handling 2021-04-01 17:11:29 +01:00
Rylan Polster 57b2660cae Revert "Merge pull request #10864 from reitermarkus/command-timeout"
This reverts commit d55bdd3ddb, reversing
changes made to 3c3bf1c74d.
2021-03-24 01:22:18 -04:00
Markus Reiter 712a95fdd0 Allow specifying timeouts for commands and downloads. 2021-03-16 18:15:21 +01:00
EricFromCanada 6fc116318e fixes for grammar and wording 2021-01-26 16:19:47 -05:00
Seeker fbafaff4fe rubocop: require braces for Sorbet sig 2021-01-18 16:52:45 -08:00
Markus ReiterandGitHub 3f6a930044 Merge pull request #10067 from reitermarkus/sudo-prompt
Fix `sudo` prompt.
2020-12-19 21:40:16 +01:00
Markus Reiter b1b4518998 Fix sudo prompt. 2020-12-19 19:41:24 +01:00
Sam Ford 778e1d6234 SystemCommand: Default debug and verbose to nil 2020-12-19 10:01:43 -05:00
Sam Ford d94afb91dd SystemCommand: Add debug parameter 2020-12-19 09:33:28 -05:00
Markus Reiter 3db55d13d6 Improve handling of SIGINT. 2020-12-18 16:48:49 +01:00
Jonathan Chang ed73d5b635 system_command: widen type for secrets 2020-11-27 17:45:18 +11:00
Markus Reiter 5be4c9b5e0 Upgrade typed sigils. 2020-11-25 17:04:19 +01:00
Markus Reiter d5b184d17a Add types for SystemCommand. 2020-11-23 05:48:43 +01:00
Markus Reiter da9289eff0 Add more type signatures. 2020-11-13 12:26:36 +01:00
Jonathan Chang 20b8fcd726 rubocop: fix Style/CollectionCompact 2020-11-10 23:28:31 +11:00
EricFromCanada 3768b7a6e9 apidoc: update comment wording, punctuation, formatting 2020-11-06 00:21:02 -05:00
Markus Reiter 61b79318ed Move include Kernel into .rbi files again and split up existing .rbi files. 2020-10-10 19:10:58 +02:00
Markus Reiter 24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Markus Reiter 16acd08d0a Don't override global system_command methods in download strategies. 2020-09-10 23:39:19 +02:00
Markus Reiter d7be7d038a Document SystemCommand. 2020-08-26 03:13:59 +02:00
Mike McQuaid 3a91c37e66 Fix RuboCop checks. 2020-08-19 17:12:32 +01:00
Markus Reiter 490e503b1b Replace Homebrew.args with Context. 2020-08-06 16:13:14 +02:00
Jonathan Chang 76709d82c5 Fix brew style. 2020-07-13 23:24:14 +10:00
Mike McQuaid bc27e38f18 Remove ARGV.debug?
Replace with `Homebrew.args.debug?`.

Part of #5730.
2020-05-23 14:38:58 +01:00
Gautham Goli acde828a45 ARGV: Replace ARGV.verbose? with Homebrew.args.verbose? 2020-02-02 14:00:04 +01:00
Issy Long 1f6168fe8a Change regexp.match?(string) to string.match?(regexp) everywhere
- Only try to call `.match?` on strings that aren't nil.
2019-10-13 23:22:51 +01:00
Issy Long 341ea60807 Auto-fix Style/RedundantBegin offenses
- This also required auto-fixes for Layout/EmptyLinesAroundBlockBody and
  Layout/InconsistentIndentation once the auto-fixer had got rid of the
  "redundant begin"s.
2019-10-13 16:04:27 +01:00
Issy Long b78028b9c2 Auto-fix Performance/RegexpMatch offenses 2019-10-13 16:04:26 +01:00
Mike McQuaid 8a8fc68264 Ruby 2.6.3 brew tests fixes 2019-10-08 17:39:31 +01:00
Markus Reiter 7f39d333bc Move assert_success to SystemCommand::Result. 2019-10-04 23:39:25 +02:00
Cheng XU 1d957c2029 system_command: automatically find secrets from ENV 2019-07-18 15:10:15 +08:00
Cheng XU 9232ca4508 system_command: allow redacting secrets in the log
Add a new argument `secrets` to specify secret tokens, so we can redact them in the log.
2019-07-18 15:06:32 +08:00
Mike McQuaid 36dbad3922 Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid e095da4d01 rubocop: enable Layout/EmptyLineAfterGuardClause. 2019-02-21 12:55:49 +00:00
Markus Reiter 2308f0c571 Skip quitting applications when not logged into GUI. 2018-10-02 16:27:45 +02:00
Mike McQuaid a11fe57cd2 cache_store: handle corrupt DBM database.
When the DBM database cannot be read by the current version of Ruby's
DBM library (due to corruption or another incompatibility) it segfaults
or freezes which takes down the entire Homebrew Ruby process.

This isn't desirable so instead perform a shell out with the Homebrew
Ruby to see if it can read the DBM database before we try to use the
information. If this hangs or crashes: silently delete the database and
recreate it.
2018-09-20 10:57:27 +01:00
Markus Reiter 91b0794329 Add SystemCommand::Result#merged_output. 2018-09-19 04:02:59 +02:00
Markus Reiter e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Mike McQuaid d7eca0b57c Use Bundler to manage vendor directory
Rather than having to manually keep track of what version each thing in
here is and copy files around by hand on update let's use Bundler's
standalone mode and careful use of `.gitignore` to help us do it.

This means a `bundle update --standalone` will allow us to update all
gems in vendor.

We could consider vendoring other gems this way in future but I'd
suggest only doing this for gems with no dependencies or at least gems
with no native extensions. The only gem this applies to that we
currently use is `ruby-prof` and I'm not convinced it's widely used
enough to warrant vendoring for everyone. Perhaps that's another
criteria: it should be functionality that's used by non-developer
commands and/or normal Homebrew usage.
2018-09-13 15:24:18 +01:00
Markus Reiter 32ad22395b Remove some #popen_reads. 2018-09-04 05:16:59 +02:00
Markus Reiter ad7054cc88 Fix executable with spaces. 2018-08-29 19:30:08 +02:00
Markus Reiter 81939dc496 Pass verbose to unpack strategies. 2018-08-02 15:52:55 +02:00
Markus Reiter 2d06497d9a Add verbose to SystemCommand verbosity. 2018-08-02 15:47:47 +02:00