mirror of
https://github.com/fuse-friends/fuse-native
synced 2024-10-27 18:34:01 +00:00
more umount fixes on osx
This commit is contained in:
parent
0d0490b781
commit
f3291fc28a
12
index.js
12
index.js
@ -2,6 +2,7 @@ var bindings = require('bindings')
|
|||||||
var fuse = bindings('fuse_bindings')
|
var fuse = bindings('fuse_bindings')
|
||||||
var fs = require('fs')
|
var fs = require('fs')
|
||||||
var os = require('os')
|
var os = require('os')
|
||||||
|
var xtend = require('xtend')
|
||||||
var path = require('path')
|
var path = require('path')
|
||||||
|
|
||||||
var noop = function () {}
|
var noop = function () {}
|
||||||
@ -24,8 +25,8 @@ fuse.setCallback(function (index, callback) {
|
|||||||
|
|
||||||
exports.mount = function (mnt, ops, cb) {
|
exports.mount = function (mnt, ops, cb) {
|
||||||
if (!cb) cb = noop
|
if (!cb) cb = noop
|
||||||
if (!ops) ops = {}
|
|
||||||
|
|
||||||
|
ops = xtend(ops) // clone
|
||||||
if (/\*|(^,)fuse-bindings(,$)/.test(process.env.DEBUG)) ops.options = ['debug'].concat(ops.options || [])
|
if (/\*|(^,)fuse-bindings(,$)/.test(process.env.DEBUG)) ops.options = ['debug'].concat(ops.options || [])
|
||||||
mnt = path.resolve(mnt)
|
mnt = path.resolve(mnt)
|
||||||
|
|
||||||
@ -37,8 +38,6 @@ exports.mount = function (mnt, ops, cb) {
|
|||||||
|
|
||||||
var callback = function (err) {
|
var callback = function (err) {
|
||||||
callback = noop
|
callback = noop
|
||||||
ops.init = init
|
|
||||||
ops.error = error
|
|
||||||
setImmediate(cb.bind(null, err))
|
setImmediate(cb.bind(null, err))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,6 +53,13 @@ exports.mount = function (mnt, ops, cb) {
|
|||||||
error(next)
|
error(next)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ops.getattr) { // we need this for unmount to work on osx
|
||||||
|
ops.getattr = function (path, cb) {
|
||||||
|
if (path !== '/') return cb(fuse.EPERM)
|
||||||
|
cb(null, {mtime: new Date(0), atime: new Date(0), ctime: new Date(0), mode: 16877, size: 4096})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var mount = function () {
|
var mount = function () {
|
||||||
fs.stat(mnt, function (err, stat) {
|
fs.stat(mnt, function (err, stat) {
|
||||||
if (err) return cb(new Error('Mountpoint does not exist'))
|
if (err) return cb(new Error('Mountpoint does not exist'))
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
"gypfile": true,
|
"gypfile": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bindings": "^1.2.1",
|
"bindings": "^1.2.1",
|
||||||
"nan": "^1.7.0"
|
"nan": "^1.7.0",
|
||||||
|
"xtend": "^4.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"standard": "^3.2.0"
|
"standard": "^3.2.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user