Skip to content

Commit 4c68f7f

Browse files
author
Benjamin Pasero
committed
storage - do not unlink backups when backup fails
1 parent dada6e1 commit 4c68f7f

3 files changed

Lines changed: 2 additions & 25 deletions

File tree

src/vs/base/node/pfs.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,6 @@ export function unlink(path: string): Promise<void> {
7777
return nfcall(fs.unlink, path);
7878
}
7979

80-
export function unlinkIgnoreError(path: string): Promise<void> {
81-
return new Promise(resolve => {
82-
fs.unlink(path, () => resolve());
83-
});
84-
}
85-
8680
export function symlink(target: string, path: string, type?: string): Promise<void> {
8781
return nfcall<void>(fs.symlink, target, path, type);
8882
}

src/vs/base/node/storage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { isUndefinedOrNull } from 'vs/base/common/types';
1111
import { mapToString, setToString } from 'vs/base/common/map';
1212
import { basename } from 'path';
1313
import { mark } from 'vs/base/common/performance';
14-
import { rename, unlinkIgnoreError, copy, renameIgnoreError } from 'vs/base/node/pfs';
14+
import { rename, copy, renameIgnoreError } from 'vs/base/node/pfs';
1515

1616
export enum StorageHint {
1717

@@ -440,7 +440,7 @@ export class SQLiteStorageDatabase implements IStorageDatabase {
440440

441441
const backupPath = this.toBackupPath(db.path);
442442

443-
return unlinkIgnoreError(backupPath).then(() => copy(db.path, backupPath));
443+
return copy(db.path, backupPath);
444444
}
445445

446446
private toBackupPath(path: string): string {

src/vs/base/test/node/pfs.test.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,6 @@ suite('PFS', () => {
119119
});
120120
});
121121

122-
test('unlinkIgnoreError', function () {
123-
const id = uuid.generateUuid();
124-
const parentDir = path.join(os.tmpdir(), 'vsctests', id);
125-
const newDir = path.join(parentDir, 'extfs', id);
126-
127-
return pfs.mkdirp(newDir, 493).then(() => {
128-
return pfs.unlinkIgnoreError(path.join(newDir, 'foo')).then(() => {
129-
130-
return pfs.del(parentDir, os.tmpdir());
131-
}, error => {
132-
assert.fail(error);
133-
134-
return Promise.reject(error);
135-
});
136-
});
137-
});
138-
139122
test('moveIgnoreError', function () {
140123
const id = uuid.generateUuid();
141124
const parentDir = path.join(os.tmpdir(), 'vsctests', id);

0 commit comments

Comments
 (0)