execution: use provided process ID for state

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure
2016-12-14 09:16:23 -08:00
parent 13399c1330
commit 7dd69a8597
6 changed files with 25 additions and 12 deletions

View File

@@ -26,13 +26,13 @@ func (s StateDir) Delete() error {
return os.RemoveAll(string(s))
}
func (s StateDir) NewProcess() (id, dir string, err error) {
dir, err = ioutil.TempDir(s.processesDir(), "")
if err != nil {
return "", "", err
func (s StateDir) NewProcess(id string) (dir string, err error) {
dir = filepath.Join(s.processesDir(), id)
if err = os.Mkdir(dir, 0700); err != nil {
return "", err
}
return filepath.Base(dir), dir, err
return dir, nil
}
func (s StateDir) ProcessDir(id string) string {