From dcd6ddbdd8de9f27c95c4719ac0a8f6a6a229e91 Mon Sep 17 00:00:00 2001 From: minhnhatnoe <86871862+minhnhatnoe@users.noreply.github.com> Date: Wed, 17 May 2023 23:11:27 +0700 Subject: [PATCH] Fix grammar error --- worker/compile.go | 13 +++++++++---- worker/run.go | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/worker/compile.go b/worker/compile.go index 9f12de3a..0c0726d9 100644 --- a/worker/compile.go +++ b/worker/compile.go @@ -2,8 +2,10 @@ package worker // Compiling anything that's more compicated than single file: // -// - Prepare a "compile_%s.sh" file, with %s being the language (cc, go, rs, java, py2, py3, pas). -// - Prepare any more files as needed. They will all be put into the CWD of the script. +// - Prepare a "compile_%s.%ext" file, with %s being the language (cc, go, rs, java, py2, py3, pas) and +// TODO: %ext being the shell extension (.sh for linux and .bat/.ps1 for windows). +// - Prepare any more files as needed. They will all be put into the CWD of the script, +// TODO: except for "special" files. // - The CWD also contains "code.%s" (%s being the language's respective extension) file, which is the contestant's source code. // - The script should do whatever it wants (unsandboxed, because it's not my job to do so) within 20 seconds. // - It should produce a single binary called "code" in the CWD. @@ -101,8 +103,11 @@ func Compile(c *CompileContext) (bool, error) { return result, c.Sub.Write(c.DB) } -// CompileAction is an action revolving writing the source into a file in "Source", -// compile it with "Command" and taking the "Output" as the result. +// CompileAction represents the following steps: +// 1. Write the source into a file in "Source". +// 2. Copy all files in Files into "Source" +// 3. Compile the source with "Command". +// 4. Produce "Output" as the result. type CompileAction struct { Source *models.File Files []*models.File diff --git a/worker/run.go b/worker/run.go index b13f545b..bb2e0b5c 100644 --- a/worker/run.go +++ b/worker/run.go @@ -126,7 +126,7 @@ func RunSingleCommand(sandbox Sandbox, r *RunContext, source []byte) (output *Sa return output, nil } -func RunMutipleCommands(sandbox Sandbox, r *RunContext, source []byte, stages []string) (output *SandboxOutput, err error) { +func RunMultipleCommands(sandbox Sandbox, r *RunContext, source []byte, stages []string) (output *SandboxOutput, err error) { command, args, err := RunCommand(r.Sub.Language) if err != nil { return nil, err @@ -193,7 +193,7 @@ func Run(sandbox Sandbox, r *RunContext) error { } else { // Problem Type is Chained Type, we need to run mutiple commands with arguments from .stages (file) stages := strings.Split(string(file.Content), "\n") - output, err = RunMutipleCommands(sandbox, r, source, stages) + output, err = RunMultipleCommands(sandbox, r, source, stages) if err != nil { return err }