feat: step shell with env variables

This commit is contained in:
lilong.129
2024-01-19 15:06:20 +08:00
parent 49eaf432f8
commit e7a8cec5db
4 changed files with 36 additions and 109 deletions

View File

@@ -2,6 +2,7 @@ package hrp
import (
"fmt"
"os"
"time"
"github.com/httprunner/funplugin/myexec"
@@ -84,6 +85,11 @@ func runStepShell(r *SessionRunner, step *TStep) (stepResult *StepResult, err er
ContentSize: 0,
}
vars := r.caseRunner.parsedConfig.Variables
for key, value := range vars {
os.Setenv(key, fmt.Sprintf("%v", value))
}
start := time.Now()
exitCode, err := myexec.RunShell(shell.String)
stepResult.Elapsed = time.Since(start).Milliseconds()