Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
392aba1f
Commit
392aba1f
authored
Aug 12, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
packer: Don't output up to \r with remote command, lost anyways
parent
d60b7692
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
packer/communicator.go
packer/communicator.go
+18
-2
No files found.
packer/communicator.go
View file @
392aba1f
...
...
@@ -116,9 +116,9 @@ OutputLoop:
for
{
select
{
case
output
:=
<-
stderrCh
:
ui
.
Message
(
strings
.
TrimSpac
e
(
output
))
ui
.
Message
(
r
.
cleanOutputLin
e
(
output
))
case
output
:=
<-
stdoutCh
:
ui
.
Message
(
strings
.
TrimSpac
e
(
output
))
ui
.
Message
(
r
.
cleanOutputLin
e
(
output
))
case
<-
exitCh
:
break
OutputLoop
}
...
...
@@ -164,3 +164,19 @@ func (r *RemoteCmd) Wait() {
<-
r
.
exitCh
}
// cleanOutputLine cleans up a line so that '\r' don't muck up the
// UI output when we're reading from a remote command.
func
(
r
*
RemoteCmd
)
cleanOutputLine
(
line
string
)
string
{
// Trim surrounding whitespace
line
=
strings
.
TrimSpace
(
line
)
// Trim up to the first carriage return, since that text would be
// lost anyways.
idx
:=
strings
.
LastIndex
(
line
,
"
\r
"
)
if
idx
>
-
1
{
line
=
line
[
idx
+
1
:
]
}
return
line
}
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