Change status messages in runners

This commit is contained in:
akp 2021-12-04 20:38:05 +00:00
parent 952b1dce9a
commit d70b5f53e5
No known key found for this signature in database
GPG key ID: AA5726202C8879B7
4 changed files with 15 additions and 2 deletions

View file

@ -68,7 +68,7 @@ func run() error {
setupTestTasks(challengeInfo, runner, &lookupTable)
setupMainTasks(challengeInputString, runner, &lookupTable)
fmt.Println("\nRunning...\n")
fmt.Println()
r, cleanupFn := runner.Run()
for roe := range r {

View file

@ -71,6 +71,9 @@ func (g *golangRunner) Run() (chan ResultOrError, func()) {
return makeErrorChan(err), nil
}
fmt.Print("Compiling...\r")
defer fmt.Print("\n\n")
// compile executable
stderrBuffer := new(bytes.Buffer)
@ -90,6 +93,8 @@ func (g *golangRunner) Run() (chan ResultOrError, func()) {
return makeErrorChan(err), nil
}
fmt.Print("Running... ")
// run executable
cmd = exec.Command(absExecPath)
cmd.Dir = g.dir

View file

@ -52,6 +52,9 @@ func (n *nimRunner) Run() (chan ResultOrError, func()) {
return makeErrorChan(err), nil
}
fmt.Print("Compiling...\r")
defer fmt.Print("\n\n")
// compile
stderrBuffer := new(bytes.Buffer)
cmd := exec.Command(nimInstallation, "compile", "-o:"+executableFilepath, "-d:release", wrapperFilepath)
@ -65,6 +68,8 @@ func (n *nimRunner) Run() (chan ResultOrError, func()) {
return makeErrorChan(errors.New("compilation failed, hence cannot continue")), nil
}
fmt.Print("Running... ")
absExecPath, err := filepath.Abs(executableFilepath)
if err != nil {
return makeErrorChan(err), nil

View file

@ -4,6 +4,7 @@ import (
"bytes"
_ "embed"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"os/exec"
@ -54,9 +55,11 @@ func (p *pythonRunner) Run() (chan ResultOrError, func()) {
pythonPathVar := filepath.Join(cwd, "lib")
fmt.Println("Running...")
// Run Python and gather output
cmd := exec.Command(python3Installation, "-B", wrapperFilename) // -B prevents .pyc files from being written
cmd.Env = append(cmd.Env, "PYTHONPATH="+pythonPathVar) // this allows the aocpy lib to be imported
cmd.Env = append(cmd.Env, "PYTHONPATH="+pythonPathVar) // this allows the aocpy lib to be imported
cmd.Dir = p.dir
cmd.Stdin = bytes.NewReader(append(taskJSON, '\n'))