1
0
mirror of https://github.com/fuse-friends/fuse-native synced 2024-10-27 18:34:01 +00:00

Handle ENXIO in force mount

This commit is contained in:
Andrew Osheroff 2020-01-24 12:01:29 +01:00
parent b0c3489030
commit 95386bf49c

View File

@ -9,10 +9,11 @@ const { beforeMount, beforeUnmount, configure, unconfigure, isConfigured } = req
const binding = require('node-gyp-build')(__dirname) const binding = require('node-gyp-build')(__dirname)
const IS_OSX = os.platform() === 'darwin' 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 OSX_FOLDER_ICON = '/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericFolderIcon.icns'
const HAS_FOLDER_ICON = IS_OSX && fs.existsSync(OSX_FOLDER_ICON) const HAS_FOLDER_ICON = IS_OSX && fs.existsSync(OSX_FOLDER_ICON)
const ENOTCONN = IS_OSX ? -57 : -107
const OpcodesAndDefaults = new Map([ const OpcodesAndDefaults = new Map([
['init', { ['init', {
op: binding.op_init op: binding.op_init
@ -246,8 +247,8 @@ class Fuse extends Nanoresource {
const self = this const self = this
if (this._force) { if (this._force) {
return fs.stat(path.join(this.mnt), (err, st) => { return fs.stat(path.join(this.mnt, 'test'), (err, st) => {
if (err && err.errno === ENOTCONN) return Fuse.unmount(this.mnt, open) if (err && (err.errno === ENOTCONN || err.errno === Fuse.ENXIO)) return Fuse.unmount(this.mnt, open)
return open() return open()
}) })
} }