@@ -11,7 +11,8 @@ import (
11
11
"github.com/pkg/errors"
12
12
13
13
"github.com/mutagen-io/mutagen/pkg/agent"
14
- "github.com/mutagen-io/mutagen/pkg/agent/transports/ssh"
14
+ "github.com/mutagen-io/mutagen/pkg/agent/transport"
15
+ "github.com/mutagen-io/mutagen/pkg/agent/transport/ssh"
15
16
"github.com/mutagen-io/mutagen/pkg/docker"
16
17
"github.com/mutagen-io/mutagen/pkg/process"
17
18
"github.com/mutagen-io/mutagen/pkg/prompting"
@@ -26,8 +27,8 @@ Hyper-V doesn't support copying files into running containers.
26
27
27
28
Would you like to continue? (yes/no)? `
28
29
29
- // transport implements the agent.Transport interface using Docker.
30
- type transport struct {
30
+ // dockerTransport implements the agent.Transport interface using Docker.
31
+ type dockerTransport struct {
31
32
// container is the target container name.
32
33
container string
33
34
// user is the container user under which agents should be invoked.
@@ -73,7 +74,7 @@ func NewTransport(container, user string, environment, parameters map[string]str
73
74
}
74
75
75
76
// Success.
76
- return & transport {
77
+ return & dockerTransport {
77
78
container : container ,
78
79
user : user ,
79
80
environment : environment ,
@@ -86,7 +87,7 @@ func NewTransport(container, user string, environment, parameters map[string]str
86
87
// specification of the working directory inside the container, as well as an
87
88
// override of the executing user. An empty user specification means to use the
88
89
// username specified in the remote URL, if any.
89
- func (t * transport ) command (command , workingDirectory , user string ) (* exec.Cmd , error ) {
90
+ func (t * dockerTransport ) command (command , workingDirectory , user string ) (* exec.Cmd , error ) {
90
91
// Set up top-level command-line flags.
91
92
var dockerArguments []string
92
93
dockerArguments = append (dockerArguments , t .daemonConnectionFlags ... )
@@ -125,8 +126,8 @@ func (t *transport) command(command, workingDirectory, user string) (*exec.Cmd,
125
126
return nil , err
126
127
}
127
128
128
- // Force it to run detached .
129
- dockerCommand .SysProcAttr = process . DetachedProcessAttributes ()
129
+ // Set the process attributes .
130
+ dockerCommand .SysProcAttr = transport . ProcessAttributes ()
130
131
131
132
// Create a copy of the current environment.
132
133
environment := os .Environ ()
@@ -152,7 +153,7 @@ func (t *transport) command(command, workingDirectory, user string) (*exec.Cmd,
152
153
// probeContainer ensures that the containerIsWindows and containerHomeDirectory
153
154
// fields are populated. It is idempotent. If probing previously failed, probing
154
155
// will simply return an error indicating the previous failure.
155
- func (t * transport ) probeContainer () error {
156
+ func (t * dockerTransport ) probeContainer () error {
156
157
// Watch for previous errors.
157
158
if t .containerProbeError != nil {
158
159
return errors .Wrap (t .containerProbeError , "previous container probing failed" )
@@ -286,7 +287,7 @@ func (t *transport) probeContainer() error {
286
287
287
288
// changeContainerStatus stops or starts the container. It is required for
288
289
// copying files on Windows when using Hyper-V.
289
- func (t * transport ) changeContainerStatus (stop bool ) error {
290
+ func (t * dockerTransport ) changeContainerStatus (stop bool ) error {
290
291
// Set up top-level command-line flags.
291
292
var dockerArguments []string
292
293
dockerArguments = append (dockerArguments , t .daemonConnectionFlags ... )
@@ -304,8 +305,8 @@ func (t *transport) changeContainerStatus(stop bool) error {
304
305
return errors .Wrap (err , "unable to set up Docker invocation" )
305
306
}
306
307
307
- // Force it to run detached .
308
- dockerCommand .SysProcAttr = process . DetachedProcessAttributes ()
308
+ // Set the process attributes .
309
+ dockerCommand .SysProcAttr = transport . ProcessAttributes ()
309
310
310
311
// Create a copy of the current environment.
311
312
environment := os .Environ ()
@@ -329,7 +330,7 @@ func (t *transport) changeContainerStatus(stop bool) error {
329
330
}
330
331
331
332
// Copy implements the Copy method of agent.Transport.
332
- func (t * transport ) Copy (localPath , remoteName string ) error {
333
+ func (t * dockerTransport ) Copy (localPath , remoteName string ) error {
333
334
// Ensure that the container has been probed.
334
335
if err := t .probeContainer (); err != nil {
335
336
return errors .Wrap (err , "unable to probe container" )
@@ -390,8 +391,8 @@ func (t *transport) Copy(localPath, remoteName string) error {
390
391
return errors .Wrap (err , "unable to set up Docker invocation" )
391
392
}
392
393
393
- // Force it to run detached .
394
- dockerCommand .SysProcAttr = process . DetachedProcessAttributes ()
394
+ // Set the process attributes .
395
+ dockerCommand .SysProcAttr = transport . ProcessAttributes ()
395
396
396
397
// Create a copy of the current environment.
397
398
environment := os .Environ ()
@@ -464,7 +465,7 @@ func (t *transport) Copy(localPath, remoteName string) error {
464
465
}
465
466
466
467
// Command implements the Command method of agent.Transport.
467
- func (t * transport ) Command (command string ) (* exec.Cmd , error ) {
468
+ func (t * dockerTransport ) Command (command string ) (* exec.Cmd , error ) {
468
469
// Ensure that the container has been probed.
469
470
if err := t .probeContainer (); err != nil {
470
471
return nil , errors .Wrap (err , "unable to probe container" )
@@ -475,7 +476,7 @@ func (t *transport) Command(command string) (*exec.Cmd, error) {
475
476
}
476
477
477
478
// ClassifyError implements the ClassifyError method of agent.Transport.
478
- func (t * transport ) ClassifyError (processState * os.ProcessState , errorOutput string ) (bool , bool , error ) {
479
+ func (t * dockerTransport ) ClassifyError (processState * os.ProcessState , errorOutput string ) (bool , bool , error ) {
479
480
// Ensure that the container has been probed.
480
481
if err := t .probeContainer (); err != nil {
481
482
return false , false , errors .Wrap (err , "unable to probe container" )
0 commit comments