Skip to content

Commit

Permalink
Merge pull request #5503 from overbool/feat/print-version
Browse files Browse the repository at this point in the history
feat(daemon): print version
  • Loading branch information
Stebalien committed Sep 21, 2018
2 parents 73ac4a8 + 7d7bca0 commit 238bd01
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/ipfs/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import (
"net/http"
_ "net/http/pprof"
"os"
"runtime"
"sort"
"sync"

version "github.com/ipfs/go-ipfs"
utilmain "github.com/ipfs/go-ipfs/cmd/ipfs/util"
oldcmds "github.com/ipfs/go-ipfs/commands"
"github.com/ipfs/go-ipfs/core"
Expand Down Expand Up @@ -194,6 +196,9 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
// let the user know we're going.
fmt.Printf("Initializing daemon...\n")

// print the ipfs version
printVersion()

managefd, _ := req.Options[adjustFDLimitKwd].(bool)
if managefd {
if err := utilmain.ManageFdLimit(); err != nil {
Expand Down Expand Up @@ -644,3 +649,10 @@ func YesNoPrompt(prompt string) bool {

return false
}

func printVersion() {
fmt.Printf("go-ipfs version: %s-%s\n", version.CurrentVersionNumber, version.CurrentCommit)
fmt.Printf("Repo version: %d\n", fsrepo.RepoVersion)
fmt.Printf("System version: %s\n", runtime.GOARCH+"/"+runtime.GOOS)
fmt.Printf("Golang version: %s\n", runtime.Version())
}
1 change: 1 addition & 0 deletions test/sharness/t0060-daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ test_expect_success "ipfs gateway works with the correct allowed origin port" '
test_expect_success "ipfs daemon output looks good" '
STARTFILE="ipfs cat /ipfs/$HASH_WELCOME_DOCS/readme" &&
echo "Initializing daemon..." >expected_daemon &&
ipfs version --all >> expected_daemon &&
sed "s/^/Swarm listening on /" listen_addrs >>expected_daemon &&
sed "s/^/Swarm announcing /" local_addrs >>expected_daemon &&
echo "API server listening on '$API_MADDR'" >>expected_daemon &&
Expand Down

0 comments on commit 238bd01

Please sign in to comment.