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
e3ab74e0
Commit
e3ab74e0
authored
Jul 16, 2015
by
georgevicbell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Config struct for docker PTY
parent
39a8ba13
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
builder/docker/communicator.go
builder/docker/communicator.go
+10
-2
No files found.
builder/docker/communicator.go
View file @
e3ab74e0
...
...
@@ -24,10 +24,14 @@ type Communicator struct {
HostDir
string
ContainerDir
string
Version
*
version
.
Version
config
*
Config
lock
sync
.
Mutex
}
type
Config
struct
{
// Pty, if true, will request a pty from docker with -t
Pty
bool
}
func
(
c
*
Communicator
)
Start
(
remote
*
packer
.
RemoteCmd
)
error
{
// Create a temporary file to store the output. Because of a bug in
// Docker, sometimes all the output doesn't properly show up. This
...
...
@@ -45,7 +49,11 @@ func (c *Communicator) Start(remote *packer.RemoteCmd) error {
var
cmd
*
exec
.
Cmd
if
c
.
canExec
()
{
cmd
=
exec
.
Command
(
"docker"
,
"exec"
,
"-i"
,
c
.
ContainerId
,
"/bin/sh"
)
if
c
.
config
.
Pty
{
cmd
=
exec
.
Command
(
"docker"
,
"exec"
,
"-i"
,
"-t"
,
c
.
ContainerId
,
"/bin/sh"
)
}
else
{
cmd
=
exec
.
Command
(
"docker"
,
"exec"
,
"-i"
,
c
.
ContainerId
,
"/bin/sh"
)
}
}
else
{
cmd
=
exec
.
Command
(
"docker"
,
"attach"
,
c
.
ContainerId
)
}
...
...
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