74 Commits

Author SHA1 Message Date
Bo Anderson
dd9359df12
system_command: fix potential issue of stderr not being read 2023-10-29 04:00:15 +00:00
Markus Reiter
4b7aed84fa
Add test for print_stdout: :debug. 2023-10-10 03:42:22 +02:00
Markus Reiter
5d87da135a
Allow printing command output when HOMEBREW_DEBUG/--debug is set. 2023-10-10 03:42:22 +02:00
Mike McQuaid
eb1355e624
Add HOMEBREW_SUDO_THROUGH_SUDO_USER
This environment variable allows telling Homebrew to use the `SUDO_USER`
variable to `sudo` through that user when Homebrew (Cask) attempts to
run `sudo`.

While we're here, clarify in some messaging that we're running `sudo`
and that that's the password we're asking for; the specific password is
configuration dependent and not the specific password for the user.

Similarly, remove the `Package installers may write to any location`
output; it's kinda spammy and doesn't feel like the right place.
2023-09-29 18:49:44 +01:00
Ilya Kulakov
476d97934f sudo: change sudo_user to sudo_as_root. 2023-04-28 11:22:54 -07:00
Ilya Kulakov
d470661b37 sudo: add the sudo_user arg to SystemCommand. 2023-04-28 11:11:53 -07:00
Ilya Kulakov
563387a7b4 sudo: explicitly specify the root user where necessary
With sudoers one may override default sudo user. This mostly works
provided the admin configured the replacement appropriately. However
there are exceptions that absolutely must be run by root such as
/usr/sbin/installer and, under certain circumstances, /bin/launchctl.
2023-04-28 11:11:53 -07:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
Markus Reiter
c480adad4f
Pass TTY width to Open3. 2023-04-17 23:30:25 +02:00
Douglas Eichelberger
79f6c7c7da brew style --fix 2023-04-03 17:35:47 -07:00
Douglas Eichelberger
f3a8241e69 Remove useless T.unsafe wrappers 2023-04-03 17:34:39 -07:00
Douglas Eichelberger
4dcd5ac47f Remove HashValidator 2023-03-19 17:37:58 -07:00
Douglas Eichelberger
1943132cf6 Move i18n out of global 2023-03-11 17:27:53 -08:00
Bo Anderson
5ecf76a611
Harden plist parsing 2023-02-22 22:52:06 +00:00
Mike McQuaid
9725e764f5
system_command: fix typo. 2023-02-14 13:02:59 +00:00
Ilya Kulakov
9ff7ceb563 sudo: pass env variables without /usr/bin/env
Using /usr/bin/env as a frontend for the actual command
prevents sudoers from restricting allowed commands and configuring
detailed command environment.
2023-02-13 22:10:35 -08:00
Bo Anderson
9b99594753
Preliminary compatibility fixes for Ruby 3 2022-10-11 02:53:27 +01:00
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 57b2660cae8cf43efd2b88d84a7174706328c001.
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 d55bdd3ddbe7ff2b1f106a41bd994dc117ca5142, reversing
changes made to 3c3bf1c74d1d7ef1d2c792719574623b6c3c4d25.
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 Reiter
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