1
0
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:
Mathias Buus 2015-03-22 12:46:33 +01:00
parent 0d0490b781
commit f3291fc28a
2 changed files with 11 additions and 4 deletions

View File

@ -2,6 +2,7 @@ var bindings = require('bindings')
var fuse = bindings('fuse_bindings')
var fs = require('fs')
var os = require('os')
var xtend = require('xtend')
var path = require('path')
var noop = function () {}
@ -24,8 +25,8 @@ fuse.setCallback(function (index, callback) {
exports.mount = function (mnt, ops, cb) {
if (!cb) cb = noop
if (!ops) ops = {}
ops = xtend(ops) // clone
if (/\*|(^,)fuse-bindings(,$)/.test(process.env.DEBUG)) ops.options = ['debug'].concat(ops.options || [])
mnt = path.resolve(mnt)
@ -37,8 +38,6 @@ exports.mount = function (mnt, ops, cb) {
var callback = function (err) {
callback = noop
ops.init = init
ops.error = error
setImmediate(cb.bind(null, err))
}
@ -54,6 +53,13 @@ exports.mount = function (mnt, ops, cb) {
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 () {
fs.stat(mnt, function (err, stat) {
if (err) return cb(new Error('Mountpoint does not exist'))

View File

@ -9,7 +9,8 @@
"gypfile": true,
"dependencies": {
"bindings": "^1.2.1",
"nan": "^1.7.0"
"nan": "^1.7.0",
"xtend": "^4.0.0"
},
"devDependencies": {
"standard": "^3.2.0"