Check that mountpoints are created
This commit is contained in:
parent
25b090a074
commit
c9b3eebc09
2 changed files with 4 additions and 2 deletions
|
@ -58,7 +58,7 @@ func (cmd CmdMount) Execute(args []string) error {
|
||||||
mountpoint := args[0]
|
mountpoint := args[0]
|
||||||
if _, err := os.Stat(mountpoint); err != nil {
|
if _, err := os.Stat(mountpoint); err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
cmd.global.Verbosef("Mountpoint [%s] doesn't exist, creating it\n", mountpoint)
|
cmd.global.Verbosef("Mountpoint %s doesn't exist, creating it\n", mountpoint)
|
||||||
err = os.Mkdir(mountpoint, os.ModeDir|0755)
|
err = os.Mkdir(mountpoint, os.ModeDir|0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -519,7 +519,9 @@ func TestMount(t *testing.T) {
|
||||||
|
|
||||||
mountpoint, err := ioutil.TempDir(TestTempDir, "restic-test-mount-")
|
mountpoint, err := ioutil.TempDir(TestTempDir, "restic-test-mount-")
|
||||||
OK(t, err)
|
OK(t, err)
|
||||||
defer OK(t, os.RemoveAll(mountpoint))
|
|
||||||
|
// We remove the mountpoint now to check that cmdMount creates it
|
||||||
|
OK(t, os.RemoveAll(mountpoint))
|
||||||
|
|
||||||
ready := make(chan struct{}, 1)
|
ready := make(chan struct{}, 1)
|
||||||
go cmdMount(t, global, mountpoint, ready)
|
go cmdMount(t, global, mountpoint, ready)
|
||||||
|
|
Loading…
Reference in a new issue