Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-unixfs
Commits
9239a1d1
Commit
9239a1d1
authored
Jan 22, 2015
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shut down cleanly
parent
a6eb3961
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
cmd/ipfswatch/main.go
cmd/ipfswatch/main.go
+14
-3
No files found.
cmd/ipfswatch/main.go
View file @
9239a1d1
...
...
@@ -4,10 +4,12 @@ import (
"flag"
"log"
"os"
"os/signal"
"path/filepath"
context
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
ma
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
process
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess"
homedir
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/mitchellh/go-homedir"
fsnotify
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/gopkg.in/fsnotify.v1"
commands
"github.com/jbenet/go-ipfs/commands"
...
...
@@ -40,6 +42,8 @@ func main() {
}
func
run
(
ipfsPath
,
watchPath
string
)
error
{
proc
:=
process
.
WithParent
(
process
.
Background
())
log
.
Printf
(
"running IPFSWatch on %s using repo at %s..."
,
watchPath
,
ipfsPath
)
ipfsPath
,
err
:=
homedir
.
Expand
(
ipfsPath
)
...
...
@@ -78,13 +82,20 @@ func run(ipfsPath, watchPath string) error {
corehttp
.
WebUIOption
,
corehttp
.
CommandsOption
(
cmdCtx
(
node
,
ipfsPath
)),
}
if
err
:=
corehttp
.
ListenAndServe
(
node
,
maddr
,
opts
...
);
err
!=
nil
{
return
nil
}
proc
.
Go
(
func
(
p
process
.
Process
)
{
if
err
:=
corehttp
.
ListenAndServe
(
node
,
maddr
,
opts
...
);
err
!=
nil
{
return
}
})
}
interrupts
:=
make
(
chan
os
.
Signal
)
signal
.
Notify
(
interrupts
,
os
.
Interrupt
,
os
.
Kill
)
for
{
select
{
case
<-
interrupts
:
return
nil
case
e
:=
<-
watcher
.
Events
:
log
.
Printf
(
"received event: %s"
,
e
)
isDir
,
err
:=
IsDirectory
(
e
.
Name
)
...
...
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