From 95386bf49c64a02ebda2e8a53f0e007c3a00a6e0 Mon Sep 17 00:00:00 2001 From: Andrew Osheroff Date: Fri, 24 Jan 2020 12:01:29 +0100 Subject: [PATCH] Handle ENXIO in force mount --- index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 4b94b7f..b04f991 100644 --- a/index.js +++ b/index.js @@ -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 @@ -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() }) }