加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby rm_rf异步?

发布时间:2020-12-17 02:42:49 所属栏目:百科 来源:网络整理
导读:如果我做 rm_rf('somewhere')mkdir('somewhere') 每隔一段时间,mkdir就会抛出一个Permission Denined.这是因为rm_rf以异步方式运行,有时在mkdir运行之前还没有完成删除dir? 如何在完成删除之前阻止它? 在Windows btw上运行它. 谢谢 解决方法 听起来像NTFS
如果我做

rm_rf('somewhere')
mkdir('somewhere')

每隔一段时间,mkdir就会抛出一个Permission Denined.这是因为rm_rf以异步方式运行,有时在mkdir运行之前还没有完成删除dir?

如何在完成删除之前阻止它?

在Windows btw上运行它.

谢谢

解决方法

听起来像NTFS的一个功能,见 Microsoft Suppport:

This file is in a state known as pending deletion. This file has been
deleted,but there are still handles open to it. NTFS will wait until
all handles to this file are closed before updating the index. If an
attempt is made to access the file,however,NTFS will deny the
attempt. Because the file is listed in the index,but is effectively
deleted,you can see the file but you cannot access it.

看看解决方案,我认为除了等待和重试之外别无其他.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读