Skip to content

Commit 1ac2dcf

Browse files
committed
Prevent fs.rm from erroring about non-existent files
We were using fs.rmdir which presumably did not have the same behavior in v14 (in v16 fs.rmdir also errors).
1 parent e346fe2 commit 1ac2dcf

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/node/socket.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class SocketProxyProvider {
7777
this.proxyPipe = pipe
7878
return Promise.all([
7979
fs.mkdir(path.dirname(this.proxyPipe), { recursive: true }),
80-
fs.rm(this.proxyPipe, { recursive: true }),
80+
fs.rm(this.proxyPipe, { force: true, recursive: true }),
8181
])
8282
})
8383
.then(() => {

test/unit/node/cli.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ describe("cli", () => {
458458

459459
beforeEach(async () => {
460460
delete process.env.VSCODE_IPC_HOOK_CLI
461-
await fs.rm(vscodeIpcPath, { recursive: true })
461+
await fs.rm(vscodeIpcPath, { force: true, recursive: true })
462462
})
463463

464464
it("should use existing if inside code-server", async () => {

test/unit/node/socket.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe("SocketProxyProvider", () => {
5353

5454
await fs.mkdir(path.join(tmpdir, "tests"), { recursive: true })
5555
const socketPath = await provider.findFreeSocketPath(path.join(tmpdir, "tests/tls-socket-proxy"))
56-
await fs.rm(socketPath, { recursive: true })
56+
await fs.rm(socketPath, { force: true, recursive: true })
5757

5858
return new Promise<void>((_resolve) => {
5959
const resolved: { [key: string]: boolean } = { client: false, server: false }

test/utils/helpers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function mockLogger() {
2929
*/
3030
export async function clean(testName: string): Promise<void> {
3131
const dir = path.join(os.tmpdir(), `code-server/tests/${testName}`)
32-
await fs.rm(dir, { recursive: true })
32+
await fs.rm(dir, { force: true, recursive: true })
3333
}
3434

3535
/**

0 commit comments

Comments
 (0)