fix delete running bundle dir when run t start cmd again
Signed-off-by: Lifubang <lifubang@acmcoder.com> code optimization after review Signed-off-by: Lifubang <lifubang@acmcoder.com>
This commit is contained in:
parent
830363acac
commit
557e8e0b0d
@ -46,6 +46,9 @@ func newBundle(id, path, workDir string, spec []byte) (b *bundle, err error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
path = filepath.Join(path, id)
|
path = filepath.Join(path, id)
|
||||||
|
if err := os.Mkdir(path, 0711); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
os.RemoveAll(path)
|
os.RemoveAll(path)
|
||||||
@ -60,10 +63,6 @@ func newBundle(id, path, workDir string, spec []byte) (b *bundle, err error) {
|
|||||||
os.RemoveAll(workDir)
|
os.RemoveAll(workDir)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if err := os.Mkdir(path, 0711); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if err := os.Mkdir(filepath.Join(path, "rootfs"), 0711); err != nil {
|
if err := os.Mkdir(filepath.Join(path, "rootfs"), 0711); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user