Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
ea8ff3cc
Commit
ea8ff3cc
authored
May 25, 2015
by
Florian R. Hanke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Executable] Handle output outside of #spawn.
parent
e26766c3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
14 deletions
+20
-14
executable.rb
lib/cocoapods/executable.rb
+20
-14
No files found.
lib/cocoapods/executable.rb
View file @
ea8ff3cc
...
...
@@ -59,8 +59,11 @@ module Pod
UI
.
message
(
"$
#{
full_command
}
"
)
if
Config
.
instance
.
verbose?
output
=
StringIO
.
new
indented
=
Indenter
.
new
(
output
)
status
=
with_verbose
do
spawn
(
bin
,
command
,
Indenter
.
new
(
output
))
spawn
(
bin
,
command
)
do
|
line
|
indented
<<
line
end
end
unless
status
.
success?
...
...
@@ -76,11 +79,18 @@ module Pod
private
def
self
.
spawn
bin
,
command
,
output
# Spawn a subprocess.
#
# @param bin [String] Name of the binary to use.
# @param arguments [Array<String>] Command arguments.
#
# @yield [String] Each output line.
#
def
self
.
spawn
bin
,
arguments
,
&
block
require
'pty'
PTY
.
spawn
(
bin
,
*
command
)
do
|
r
,
_
,
pid
|
PTY
.
spawn
(
bin
,
*
arguments
)
do
|
r
,
_
,
pid
|
begin
r
.
each
{
|
line
|
output
.
write
line
}
r
.
each
(
&
block
)
if
block_given?
status
=
PTY
.
check
(
pid
)
return
status
if
status
end
...
...
@@ -89,6 +99,8 @@ module Pod
# Yields to a block, redirecting STDOUT/STDERR if verbose output is used.
#
# @yield [Array<Indenter, Indenter>] If verbose, will yield an indenter.
#
def
self
.
with_verbose
&
block
if
Config
.
instance
.
verbose?
with_redirected
(
Indenter
.
new
(
STDOUT
),
Indenter
.
new
(
STDERR
),
&
block
)
...
...
@@ -99,6 +111,8 @@ module Pod
# Redirects the output to the given stdout/stderr.
#
# @yield [void]
#
def
self
.
with_redirected
stdout
,
stderr
old_stdout
=
$stdout
old_stderr
=
$stderr
...
...
@@ -138,16 +152,8 @@ module Pod
#
# @return [void]
#
def
write
(
value
)
@io
.
write
"
#{
indent
}#{
value
}
"
end
def
string
@io
.
string
end
def
flush
# We ignore calls to flush.
def
<<
(
value
)
@io
<<
"
#{
indent
}#{
value
}
"
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment