Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jacobsa-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
jacobsa-fuse
Commits
19934c68
Commit
19934c68
authored
Jul 24, 2015
by
Aaron Jacobs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Touched up callMount.
parent
a9693474
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
13 deletions
+25
-13
mount_darwin.go
mount_darwin.go
+25
-13
No files found.
mount_darwin.go
View file @
19934c68
...
...
@@ -51,16 +51,25 @@ func openOSXFUSEDev() (dev *os.File, err error) {
}
}
func
callMount
(
dir
string
,
conf
*
mountConfig
,
f
*
os
.
File
,
ready
chan
<-
struct
{},
errp
*
error
)
error
{
bin
:=
"/Library/Filesystems/osxfusefs.fs/Support/mount_osxfusefs"
func
callMount
(
dir
string
,
cfg
*
mountConfig
,
dev
*
os
.
File
,
ready
chan
<-
error
)
(
err
error
)
{
const
bin
=
"/Library/Filesystems/osxfusefs.fs/Support/mount_osxfusefs"
// The mount helper doesn't understand any escaping.
for
k
,
v
:=
range
conf
.
options
{
if
strings
.
Contains
(
k
,
","
)
||
strings
.
Contains
(
v
,
","
)
{
// Silly limitation but the mount helper does not
// understand any escaping. See TestMountOptionCommaError.
return
fmt
.
Errorf
(
"mount options cannot contain commas on darwin: %q=%q"
,
k
,
v
)
return
fmt
.
Errorf
(
"mount options cannot contain commas on darwin: %q=%q"
,
k
,
v
)
}
}
// Call the mount helper, passing in the device file and saving output into a
// buffer.
cmd
:=
exec
.
Command
(
bin
,
"-o"
,
conf
.
getOptions
(),
...
...
@@ -74,33 +83,36 @@ func callMount(dir string, conf *mountConfig, f *os.File, ready chan<- struct{},
"3"
,
dir
,
)
cmd
.
ExtraFiles
=
[]
*
os
.
File
{
f
}
cmd
.
ExtraFiles
=
[]
*
os
.
File
{
dev
}
cmd
.
Env
=
os
.
Environ
()
cmd
.
Env
=
append
(
cmd
.
Env
,
"MOUNT_FUSEFS_CALL_BY_LIB="
)
// TODO this is used for fs typenames etc, let app influence it
cmd
.
Env
=
append
(
cmd
.
Env
,
"MOUNT_FUSEFS_DAEMON_PATH="
+
bin
)
var
buf
bytes
.
Buffer
cmd
.
Stdout
=
&
buf
cmd
.
Stderr
=
&
buf
err
:
=
cmd
.
Start
()
err
=
cmd
.
Start
()
if
err
!=
nil
{
return
err
return
}
// In the background, wait for the command to complete.
go
func
()
{
err
:=
cmd
.
Wait
()
if
err
!=
nil
{
if
buf
.
Len
()
>
0
{
output
:=
buf
.
Bytes
()
output
=
bytes
.
TrimRight
(
output
,
"
\n
"
)
msg
:=
err
.
Error
()
+
": "
+
string
(
output
)
err
=
errors
.
New
(
msg
)
err
=
fmt
.
Errorf
(
"%v: %s"
,
err
,
output
)
}
}
*
errp
=
err
close
(
ready
)
ready
<-
err
}()
return
err
return
}
// Begin the process of mounting at the given directory, returning a connection
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment