diff --git a/package.json b/package.json index 3bc754db80..9a4196eb81 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "text-buffer", - "version": "13.15.3", + "version": "13.15.4-0", "description": "A container for large mutable strings with annotated regions", "main": "./lib/text-buffer", "scripts": { @@ -48,7 +48,7 @@ "diff": "^2.2.1", "emissary": "^1.0.0", "event-kit": "^2.4.0", - "fs-admin": "^0.1.7", + "fs-admin": "^0.5.0", "fs-plus": "^3.0.0", "grim": "^2.0.2", "mkdirp": "^0.5.1", diff --git a/spec/text-buffer-io-spec.js b/spec/text-buffer-io-spec.js index ec4e518283..0816a58d4d 100644 --- a/spec/text-buffer-io-spec.js +++ b/spec/text-buffer-io-spec.js @@ -448,7 +448,7 @@ describe('TextBuffer IO', () => { }) describe('when a permission error occurs', () => { - if (process.platform !== 'darwin') return + if (process.platform === 'win32') return beforeEach(() => { const save = NativeTextBuffer.prototype.save diff --git a/src/text-buffer.js b/src/text-buffer.js index 37b44d5d2a..127ac82d55 100644 --- a/src/text-buffer.js +++ b/src/text-buffer.js @@ -1921,7 +1921,8 @@ class TextBuffer { try { await this.buffer.save(destination, this.getEncoding()) } catch (error) { - if (error.code === 'EACCES' && destination === filePath && process.platform === 'darwin') { + const canEscalate = process.platform === 'darwin' || process.platform === 'linux' + if (error.code === 'EACCES' && destination === filePath && canEscalate) { const fsAdmin = require('fs-admin') try { await this.buffer.save(fsAdmin.createWriteStream(filePath), this.getEncoding())