feat: allow for setup.sh based user fixtures
This commit is contained in:
@@ -17,7 +17,7 @@ type recordIO struct {
|
||||
err io.Writer
|
||||
}
|
||||
|
||||
func recordScenario(target, shellPath string, rio recordIO, sandboxConfig map[string]string) error {
|
||||
func recordScenario(target, shellPath string, rio recordIO, sandboxConfig map[string]string, setupScripts []string) error {
|
||||
rawIn, rawOut, cleanup, err := newRecordFiles()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -40,7 +40,7 @@ func recordScenario(target, shellPath string, rio recordIO, sandboxConfig map[st
|
||||
|
||||
output.Fprintln(rio.err, "Run commands in the recorder shell, then type exit to finish.")
|
||||
|
||||
if err := runRecordSession(target, rawIn, rawOut, shellPath, sandbox, rio, sandboxConfig); err != nil {
|
||||
if err := runRecordSession(target, rawIn, rawOut, shellPath, sandbox, rio, sandboxConfig, setupScripts); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -119,10 +119,10 @@ func newRecordSandboxForPathEnv(pathEnv string) (recordSandbox, func(), error) {
|
||||
return sandbox, cleanup, nil
|
||||
}
|
||||
|
||||
func runRecordSession(dir, rawIn, rawOut, shellPath string, sandbox recordSandbox, rio recordIO, sandboxConfig map[string]string) error {
|
||||
func runRecordSession(dir, rawIn, rawOut, shellPath string, sandbox recordSandbox, rio recordIO, sandboxConfig map[string]string, setupScripts []string) error {
|
||||
cmd := exec.Command("script", "-q", "-E", "always", "-I", rawIn, "-O", rawOut, "-c", shellPath)
|
||||
cmd.Dir = dir
|
||||
cmd.Env = recordSessionEnv(sandbox, sandboxConfig)
|
||||
cmd.Env = recordSessionEnv(sandbox, sandboxConfig, setupScripts)
|
||||
cmd.Stdin = rio.in
|
||||
cmd.Stdout = rio.out
|
||||
cmd.Stderr = rio.err
|
||||
|
||||
Reference in New Issue
Block a user