Skip to content

Commit

Permalink
fix emptydir on windows (denoland/std#531)
Browse files Browse the repository at this point in the history
  • Loading branch information
zekth authored and ry committed Jul 8, 2019
1 parent c08a27d commit 1a42695
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fs/empty_dir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function emptyDir(dir: string): Promise<void> {
const item = items.shift();
if (item && item.name) {
const fn = dir + "/" + item.name;
Deno.remove(fn, { recursive: true });
await Deno.remove(fn, { recursive: true });
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions fs/empty_dir_test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import { test } from "../testing/mod.ts";
import { assertEquals, assertThrows } from "../testing/asserts.ts";
import {
assertEquals,
assertThrows,
assertThrowsAsync
} from "../testing/asserts.ts";
import { emptyDir, emptyDirSync } from "./empty_dir.ts";
import * as path from "./path/mod.ts";

Expand Down Expand Up @@ -38,7 +42,6 @@ test(function emptyDirSyncIfItNotExist(): void {
}
});

/* TODO(ry) Re-enable this test. It's broken on windows.
test(async function emptyDirIfItExist(): Promise<void> {
const testDir = path.join(testdataDir, "empty_dir_test_3");
const testNestDir = path.join(testDir, "nest");
Expand Down Expand Up @@ -81,7 +84,6 @@ test(async function emptyDirIfItExist(): Promise<void> {
await Deno.remove(testDir, { recursive: true });
}
});
*/

test(function emptyDirSyncIfItExist(): void {
const testDir = path.join(testdataDir, "empty_dir_test_4");
Expand Down

0 comments on commit 1a42695

Please sign in to comment.