|
|
@@ -7,8 +7,8 @@ import (
|
|
|
)
|
|
|
|
|
|
type Executor struct {
|
|
|
- cwd string // 当前工作目录
|
|
|
- pg *processGroup // 当前前台进程
|
|
|
+ cwd string // 当前所在目录
|
|
|
+ pg *processGroup // 当前执行进程
|
|
|
}
|
|
|
|
|
|
func NewExecutor() *Executor {
|
|
|
@@ -41,7 +41,12 @@ func (e *Executor) Exec(p ExecuteParams) (*ExecuteResult, error) {
|
|
|
e.pg = nil // 命令结束
|
|
|
}()
|
|
|
|
|
|
- return executeInternal(p, func(pg *processGroup) { e.pg = pg })
|
|
|
+ result, err := executeInternal(p, func(pg *processGroup) { e.pg = pg })
|
|
|
+ if result != nil {
|
|
|
+ result.Cwd = e.cwd
|
|
|
+ }
|
|
|
+
|
|
|
+ return result, err
|
|
|
}
|
|
|
|
|
|
func isCD(cmd string) bool {
|