mirror of
https://gitlab.com/TECHNOFAB/nixtest.git
synced 2026-02-02 11:25:10 +01:00
chore!: default to pure mode, rename --pure flag to --impure for switching
This commit is contained in:
parent
22b43c9fe8
commit
c9298b91f4
11 changed files with 29 additions and 29 deletions
|
|
@ -14,7 +14,7 @@ import (
|
|||
type Service interface {
|
||||
BuildDerivation(derivation string) (string, error)
|
||||
BuildAndParseJSON(derivation string) (any, error)
|
||||
BuildAndRunScript(derivation string, pureEnv bool) (exitCode int, stdout string, stderr string, err error)
|
||||
BuildAndRunScript(derivation string, impureEnv bool) (exitCode int, stdout string, stderr string, err error)
|
||||
}
|
||||
|
||||
type DefaultService struct {
|
||||
|
|
@ -72,7 +72,7 @@ func (s *DefaultService) BuildAndParseJSON(derivation string) (any, error) {
|
|||
}
|
||||
|
||||
// BuildAndRunScript builds a derivation and runs it as a script
|
||||
func (s *DefaultService) BuildAndRunScript(derivation string, pureEnv bool) (exitCode int, stdout string, stderr string, err error) {
|
||||
func (s *DefaultService) BuildAndRunScript(derivation string, impureEnv bool) (exitCode int, stdout string, stderr string, err error) {
|
||||
exitCode = -1
|
||||
path, err := s.BuildDerivation(derivation)
|
||||
if err != nil {
|
||||
|
|
@ -80,10 +80,10 @@ func (s *DefaultService) BuildAndRunScript(derivation string, pureEnv bool) (exi
|
|||
}
|
||||
|
||||
var cmdArgs []string
|
||||
if pureEnv {
|
||||
cmdArgs = append([]string{"env", "-i"}, "bash", path)
|
||||
} else {
|
||||
if impureEnv {
|
||||
cmdArgs = []string{"bash", path}
|
||||
} else {
|
||||
cmdArgs = append([]string{"env", "-i"}, "bash", path)
|
||||
}
|
||||
|
||||
cmd := s.commandExecutor(cmdArgs[0], cmdArgs[1:]...)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue