exec/linux: move Limit to after Start

This commit is contained in:
Clint Shryock
2015-09-16 09:13:54 -05:00
committed by Alex Dadgar
parent 15e64312b7
commit f65406009f
2 changed files with 7 additions and 5 deletions

View File

@@ -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,

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"os/user"
"strconv"
"syscall"
"github.com/hashicorp/go-multierror"