babarot / gomi

🗑️ Replacement for UNIX rm command!
https://babarot.me/gomi
MIT License
316 stars 13 forks source link

fオプションを指定すると稀に削除が出来なくなる #21

Closed yasuno0327 closed 2 years ago

yasuno0327 commented 3 years ago

gomi -rf hogeなどfオプションを指定して削除を実行すると稀に削除が出来ないことがあります。 こちらでfオプションを指定している場合のみゴルーチンの実行を待たないため、os.Renameが実行されないことが原因のようです。

eg.Go(func() error {
            _, err := os.Stat(arg)
            if os.IsNotExist(err) {
                return fmt.Errorf("%s: no such file or directory", arg)
            }
            file, err := makeFile(groupID, arg)
            if err != nil {
                return err
            }

            time.Sleep(time.Second * 10)

上記のようにゴルーチン内にスリープ処理を挟むと削除されなくなります。

babarot commented 3 years ago

遅くなりすみません

ありがとうございます。確認します

babarot commented 2 years ago

Closing as #25