github.com/quickfeed/quickfeed@v0.0.0-20240507093252-ed8ca812a09c/ci/local_windows.go (about) 1 package ci 2 3 import ( 4 "context" 5 "os/exec" 6 "strings" 7 ) 8 9 // Local is an implementation of the CI interface executing code locally. 10 type Local struct{} 11 12 // Run implements the CI interface. This method blocks until the job has been 13 // completed or an error occurs, e.g., the context times out. 14 func (l *Local) Run(ctx context.Context, job *Job) (string, error) { 15 cmd := exec.Command("bash", "-c", strings.Join(job.Commands, "\n")) 16 b, err := cmd.Output() 17 if err != nil { 18 return "", err 19 } 20 return string(b), nil 21 }