goctl add plugin support (#243)
* add plugin support * add plugin support * add plugin support * add plugin support * add plugin support * add plugin support * add plugin support * add plugin support * add plugin support * add plugin support * add plugin support * remove no need * add plugin support * rename * rename * add plugin support * refactor * update plugin * refactor * refactor * refactor * update plugin * newline Co-authored-by: anqiansong <anqiansong@xiaoheiban.cn>
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
"github.com/tal-tech/go-zero/tools/goctl/vars"
|
||||
)
|
||||
|
||||
func Run(arg string, dir string) (string, error) {
|
||||
func Run(arg string, dir string, in ...*bytes.Buffer) (string, error) {
|
||||
goos := runtime.GOOS
|
||||
var cmd *exec.Cmd
|
||||
switch goos {
|
||||
@@ -28,6 +28,9 @@ func Run(arg string, dir string) (string, error) {
|
||||
}
|
||||
stdout := new(bytes.Buffer)
|
||||
stderr := new(bytes.Buffer)
|
||||
if len(in) > 0 {
|
||||
cmd.Stdin = in[0]
|
||||
}
|
||||
cmd.Stdout = stdout
|
||||
cmd.Stderr = stderr
|
||||
err := cmd.Run()
|
||||
|
||||
Reference in New Issue
Block a user