1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-20 19:19:06 +08:00

Merge pull request #5503 from overbool/feat/print-version

feat(daemon): print version
This commit is contained in:
Steven Allen
2018-09-21 20:55:26 +00:00
committed by GitHub
2 changed files with 13 additions and 0 deletions

View File

@ -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"
@ -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 {
@ -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())
}

View File

@ -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 &&