mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-22 00:32:11 +08:00
feat: step shell with env variables
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user