Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
ad7054cc
Commit
ad7054cc
authored
6 years ago
by
Markus Reiter
Browse files
Options
Downloads
Patches
Plain Diff
Fix executable with spaces.
parent
0af24cf8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Library/Homebrew/system_command.rb
+1
-1
1 addition, 1 deletion
Library/Homebrew/system_command.rb
Library/Homebrew/test/system_command_spec.rb
+19
-2
19 additions, 2 deletions
Library/Homebrew/test/system_command_spec.rb
with
20 additions
and
3 deletions
Library/Homebrew/system_command.rb
+
1
−
1
View file @
ad7054cc
...
...
@@ -119,7 +119,7 @@ class SystemCommand
executable
,
*
args
=
command
raw_stdin
,
raw_stdout
,
raw_stderr
,
raw_wait_thr
=
Open3
.
popen3
(
env
,
executable
,
*
args
,
**
options
)
Open3
.
popen3
(
env
,
[
executable
,
executable
],
*
args
,
**
options
)
write_input_to
(
raw_stdin
)
raw_stdin
.
close_write
...
...
This diff is collapsed.
Click to expand it.
Library/Homebrew/test/system_command_spec.rb
+
19
−
2
View file @
ad7054cc
...
...
@@ -21,7 +21,7 @@ describe SystemCommand do
it
"includes the given variables explicitly"
do
expect
(
Open3
)
.
to
receive
(
:popen3
)
.
with
(
an_instance_of
(
Hash
),
"env"
,
"A=1"
,
"B=2"
,
"C=3"
,
"env"
,
*
env_args
,
{})
.
with
(
an_instance_of
(
Hash
),
[
"env"
,
"env"
],
"A=1"
,
"B=2"
,
"C=3"
,
"env"
,
*
env_args
,
{})
.
and_call_original
command
.
run!
...
...
@@ -46,7 +46,7 @@ describe SystemCommand do
it
"includes the given variables explicitly"
do
expect
(
Open3
)
.
to
receive
(
:popen3
)
.
with
(
an_instance_of
(
Hash
),
"/usr/bin/sudo"
,
"-E"
,
"--"
,
.
with
(
an_instance_of
(
Hash
),
[
"/usr/bin/sudo"
,
"/usr/bin/sudo"
],
"-E"
,
"--"
,
"env"
,
"A=1"
,
"B=2"
,
"C=3"
,
"env"
,
*
env_args
,
{})
.
and_wrap_original
do
|
original_popen3
,
*
_
,
&
block
|
original_popen3
.
call
(
"true"
,
&
block
)
...
...
@@ -227,5 +227,22 @@ describe SystemCommand do
args:
[
"-c"
,
'printf "\r%s" "################### 27.6%" 1>&2'
]
}.
to
output
(
"
\r
################### 27.6%"
).
to_stderr
end
context
"when given an executable with spaces and no arguments"
do
let
(
:executable
)
{
mktmpdir
/
"App Uninstaller"
}
before
(
:each
)
do
executable
.
write
<<~
SH
#!/usr/bin/env bash
true
SH
FileUtils
.
chmod
"+x"
,
executable
end
it
"does not interpret the executable as a shell line"
do
expect
(
system_command
(
executable
)).
to
be_a_success
end
end
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment