mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
console: handle welcome message error
This commit is contained in:
parent
72c98dc41f
commit
b65cd86326
1 changed files with 12 additions and 7 deletions
|
|
@ -18,6 +18,7 @@ package console
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/ethereum/go-ethereum/log"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
|
@ -276,12 +277,16 @@ func (c *Console) AutoCompleteInput(line string, pos int) (string, []string, str
|
||||||
func (c *Console) Welcome() {
|
func (c *Console) Welcome() {
|
||||||
// Print some generic Geth metadata
|
// Print some generic Geth metadata
|
||||||
fmt.Fprintf(c.printer, "Welcome to the Geth JavaScript console!\n\n")
|
fmt.Fprintf(c.printer, "Welcome to the Geth JavaScript console!\n\n")
|
||||||
c.jsre.Run(`
|
for _, command := range []string{
|
||||||
console.log("instance: " + web3.version.node);
|
`console.log("instance: " + web3.version.node);`,
|
||||||
console.log("coinbase: " + eth.coinbase);
|
`console.log("coinbase: " + eth.coinbase);`,
|
||||||
console.log("at block: " + eth.blockNumber + " (" + new Date(1000 * eth.getBlock(eth.blockNumber).timestamp) + ")");
|
`console.log("at block: " + eth.blockNumber + " (" + new Date(1000 * eth.getBlock(eth.blockNumber).timestamp) + ")");`,
|
||||||
console.log(" datadir: " + admin.datadir);
|
`console.log("datadir: " + admin.datadir);`,
|
||||||
`)
|
} {
|
||||||
|
if _, err := c.jsre.Run(command); err != nil {
|
||||||
|
log.Error("Geth JavaScript console error", "err", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
// List all the supported modules for the user to call
|
// List all the supported modules for the user to call
|
||||||
if apis, err := c.client.SupportedModules(); err == nil {
|
if apis, err := c.client.SupportedModules(); err == nil {
|
||||||
modules := make([]string, 0, len(apis))
|
modules := make([]string, 0, len(apis))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue