forked from helmutkemper/iotmaker.docker.builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfuncContainerExecCommand.go
More file actions
54 lines (50 loc) · 1.21 KB
/
funcContainerExecCommand.go
File metadata and controls
54 lines (50 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package iotmakerdockerbuilder
import "github.com/helmutkemper/util"
// ContainerExecCommand
//
// Português:
//
// Executa comandos dentro do container.
//
// Entrada:
// commands: lista de comandos. Ex.: []string{"ls", "-l"}
//
// Saída:
// exitCode: código de saída do comando.
// runing: indica se o comando está rodando.
// stdOutput: saída padrão do comando.
// stdError: saída de erro do comando.
// err: objeto de erro padrão.
//
// English:
//
// Execute commands inside the container.
//
// Input:
// commands: command list. Eg: []string{"ls", "-l"}
//
// Output:
// exitCode: command exit code.
// runing: indicates whether the command is running.
// stdOutput: standard output of the command.
// stdError: error output from the command.
// err: standard error object.
func (e *ContainerBuilder) ContainerExecCommand(
commands []string,
) (
exitCode int,
runing bool,
stdOutput []byte,
stdError []byte,
err error,
) {
if e.containerID == "" {
err = e.getIdByContainerName()
if err != nil {
util.TraceToLog()
return
}
}
exitCode, runing, stdOutput, stdError, err = e.dockerSys.ContainerExecCommand(e.containerID, commands)
return
}