mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
exec/linux: move Limit to after Start
This commit is contained in:
committed by
Alex Dadgar
parent
15e64312b7
commit
f65406009f
@@ -52,15 +52,16 @@ func (d *ExecDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle,
|
||||
|
||||
// Setup the command
|
||||
cmd := executor.Command(command, args...)
|
||||
err := cmd.Limit(task.Resources)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to constrain resources: %s", err)
|
||||
}
|
||||
err = cmd.Start()
|
||||
err := cmd.Start()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to start command: %v", err)
|
||||
}
|
||||
|
||||
err = cmd.Limit(task.Resources)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to constrain resources: %s", err)
|
||||
}
|
||||
|
||||
// Return a driver handle
|
||||
h := &execHandle{
|
||||
cmd: cmd,
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/user"
|
||||
"strconv"
|
||||
"syscall"
|
||||
|
||||
"github.com/hashicorp/go-multierror"
|
||||
|
||||
Reference in New Issue
Block a user