Skip to content

Commit

Permalink
Handle ENXIO in force mount
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewosh committed Jan 24, 2020
1 parent b0c3489 commit 95386bf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ const { beforeMount, beforeUnmount, configure, unconfigure, isConfigured } = req
const binding = require('node-gyp-build')(__dirname)

const IS_OSX = os.platform() === 'darwin'
const ENOTCONN = IS_OSX ? -57 : -107
const OSX_FOLDER_ICON = '/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericFolderIcon.icns'
const HAS_FOLDER_ICON = IS_OSX && fs.existsSync(OSX_FOLDER_ICON)

const ENOTCONN = IS_OSX ? -57 : -107

const OpcodesAndDefaults = new Map([
['init', {
op: binding.op_init
Expand Down Expand Up @@ -246,8 +247,8 @@ class Fuse extends Nanoresource {
const self = this

if (this._force) {
return fs.stat(path.join(this.mnt), (err, st) => {
if (err && err.errno === ENOTCONN) return Fuse.unmount(this.mnt, open)
return fs.stat(path.join(this.mnt, 'test'), (err, st) => {
if (err && (err.errno === ENOTCONN || err.errno === Fuse.ENXIO)) return Fuse.unmount(this.mnt, open)
return open()
})
}
Expand Down

0 comments on commit 95386bf

Please sign in to comment.