Merge pull request #239 from vibe-d/fix_windows_direcory_lock
Fix bogus file access denied error after listDirectory calls on Windows
This commit is contained in:
commit
e018e161e7
|
@ -375,7 +375,7 @@ void listDirectory(string path, scope bool delegate(FileInfo info) @safe del)
|
||||||
auto ch = createChannel!S();
|
auto ch = createChannel!S();
|
||||||
TaskSettings ts;
|
TaskSettings ts;
|
||||||
ts.priority = 10 * Task.basePriority;
|
ts.priority = 10 * Task.basePriority;
|
||||||
runWorkerTaskH(ioTaskSettings, (string path, Channel!S ch) nothrow {
|
auto t = runWorkerTaskH(ioTaskSettings, (string path, Channel!S ch) nothrow {
|
||||||
scope (exit) ch.close();
|
scope (exit) ch.close();
|
||||||
try {
|
try {
|
||||||
foreach (DirEntry ent; dirEntries(path, SpanMode.shallow)) {
|
foreach (DirEntry ent; dirEntries(path, SpanMode.shallow)) {
|
||||||
|
@ -389,6 +389,11 @@ void listDirectory(string path, scope bool delegate(FileInfo info) @safe del)
|
||||||
}
|
}
|
||||||
}, path, ch);
|
}, path, ch);
|
||||||
|
|
||||||
|
scope (exit) {
|
||||||
|
t.interrupt();
|
||||||
|
t.joinUninterruptible();
|
||||||
|
}
|
||||||
|
|
||||||
S itm;
|
S itm;
|
||||||
while (ch.tryConsumeOne(itm)) {
|
while (ch.tryConsumeOne(itm)) {
|
||||||
if (itm.error.length)
|
if (itm.error.length)
|
||||||
|
|
Loading…
Reference in a new issue