mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-21 19:50:56 +08:00
Merge pull request #5503 from overbool/feat/print-version
feat(daemon): print version
This commit is contained in:
@ -8,9 +8,11 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
version "github.com/ipfs/go-ipfs"
|
||||||
utilmain "github.com/ipfs/go-ipfs/cmd/ipfs/util"
|
utilmain "github.com/ipfs/go-ipfs/cmd/ipfs/util"
|
||||||
oldcmds "github.com/ipfs/go-ipfs/commands"
|
oldcmds "github.com/ipfs/go-ipfs/commands"
|
||||||
"github.com/ipfs/go-ipfs/core"
|
"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.
|
// let the user know we're going.
|
||||||
fmt.Printf("Initializing daemon...\n")
|
fmt.Printf("Initializing daemon...\n")
|
||||||
|
|
||||||
|
// print the ipfs version
|
||||||
|
printVersion()
|
||||||
|
|
||||||
managefd, _ := req.Options[adjustFDLimitKwd].(bool)
|
managefd, _ := req.Options[adjustFDLimitKwd].(bool)
|
||||||
if managefd {
|
if managefd {
|
||||||
if err := utilmain.ManageFdLimit(); err != nil {
|
if err := utilmain.ManageFdLimit(); err != nil {
|
||||||
@ -644,3 +649,10 @@ func YesNoPrompt(prompt string) bool {
|
|||||||
|
|
||||||
return false
|
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())
|
||||||
|
}
|
||||||
|
@ -42,6 +42,7 @@ test_expect_success "ipfs gateway works with the correct allowed origin port" '
|
|||||||
test_expect_success "ipfs daemon output looks good" '
|
test_expect_success "ipfs daemon output looks good" '
|
||||||
STARTFILE="ipfs cat /ipfs/$HASH_WELCOME_DOCS/readme" &&
|
STARTFILE="ipfs cat /ipfs/$HASH_WELCOME_DOCS/readme" &&
|
||||||
echo "Initializing daemon..." >expected_daemon &&
|
echo "Initializing daemon..." >expected_daemon &&
|
||||||
|
ipfs version --all >> expected_daemon &&
|
||||||
sed "s/^/Swarm listening on /" listen_addrs >>expected_daemon &&
|
sed "s/^/Swarm listening on /" listen_addrs >>expected_daemon &&
|
||||||
sed "s/^/Swarm announcing /" local_addrs >>expected_daemon &&
|
sed "s/^/Swarm announcing /" local_addrs >>expected_daemon &&
|
||||||
echo "API server listening on '$API_MADDR'" >>expected_daemon &&
|
echo "API server listening on '$API_MADDR'" >>expected_daemon &&
|
||||||
|
Reference in New Issue
Block a user