Refactor Nomad Command Generation.

- Abstracting from the exec form while generating.
- Removal of single quotes (usage of only double-quotes).
- Bash-nesting using escaping of special characters.
This commit is contained in:
Maximilian Paß
2023-03-06 00:20:09 +00:00
committed by Sebastian Serth
parent f309d0f70e
commit 7dadc5dfe9
13 changed files with 1148 additions and 150 deletions

View File

@ -232,7 +232,7 @@ func (r *NomadJob) Destroy() error {
}
func prepareExecution(request *dto.ExecutionRequest, environmentCtx context.Context) (
command []string, ctx context.Context, cancel context.CancelFunc,
command string, ctx context.Context, cancel context.CancelFunc,
) {
command = request.FullCommand()
if request.TimeLimit == 0 {
@ -243,7 +243,7 @@ func prepareExecution(request *dto.ExecutionRequest, environmentCtx context.Cont
return command, ctx, cancel
}
func (r *NomadJob) executeCommand(ctx context.Context, command []string, privilegedExecution bool,
func (r *NomadJob) executeCommand(ctx context.Context, command string, privilegedExecution bool,
stdin io.ReadWriter, stdout, stderr io.Writer, exit chan<- ExitInfo,
) {
exitCode, err := r.api.ExecuteCommand(r.id, ctx, command, true, privilegedExecution, stdin, stdout, stderr)