Skip to content

Commit

Permalink
Fix grammar error
Browse files Browse the repository at this point in the history
  • Loading branch information
minhnhatnoe committed May 17, 2023
1 parent eea1ae5 commit 9742530
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions worker/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions worker/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 9742530

Please sign in to comment.