mirror of
https://github.com/zrepl/zrepl.git
synced 2025-08-15 09:32:25 +02:00
zfs: support destroy
This commit is contained in:
22
zfs/zfs.go
22
zfs/zfs.go
@ -182,3 +182,25 @@ func ZFSSet(fs DatasetPath, prop, val string) (err error) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func ZFSDestroy(dataset string) (err error) {
|
||||
|
||||
cmd := exec.Command(ZFS_BINARY, "destroy", dataset)
|
||||
|
||||
stderr := bytes.NewBuffer(make([]byte, 0, 1024))
|
||||
cmd.Stderr = stderr
|
||||
|
||||
if err = cmd.Start(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = cmd.Wait(); err != nil {
|
||||
err = ZFSError{
|
||||
Stderr: stderr.Bytes(),
|
||||
WaitErr: err,
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user