36 lines
726 B
Go
36 lines
726 B
Go
|
// Package cmd...
|
||
|
//
|
||
|
// Description : cmd...
|
||
|
//
|
||
|
// Author : go_developer@163.com<白茶清欢>
|
||
|
//
|
||
|
// Date : 2021-11-12 2:28 下午
|
||
|
package cmd
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
// TestExecute ...
|
||
|
//
|
||
|
// Author : go_developer@163.com<白茶清欢>
|
||
|
//
|
||
|
// Date : 2:28 下午 2021/11/12
|
||
|
func TestExecute(t *testing.T) {
|
||
|
r := Execute(Config{
|
||
|
WorkDir: "/tmp",
|
||
|
Command: "ls",
|
||
|
Script: "",
|
||
|
ParameterList: []Parameter{{"", "-l"}, {"", "-a"}},
|
||
|
})
|
||
|
fmt.Println(string(r.Output), r.Err, r.ExecuteCommand, r.WorkDir)
|
||
|
r = Execute(Config{
|
||
|
WorkDir: "",
|
||
|
Command: "sh",
|
||
|
Script: "test.sh",
|
||
|
ParameterList: []Parameter{},
|
||
|
})
|
||
|
fmt.Println(string(r.Output), r.Err, r.ExecuteCommand, r.WorkDir)
|
||
|
}
|