Skip to content

Commit 8b90a49

Browse files
fjlkaralabe
authored andcommitted
[release/1.4.6] console: remove unnecessary JS evaluation in Welcome
(cherry picked from commit ad0e6e9)
1 parent c046126 commit 8b90a49

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

console/console.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -244,25 +244,23 @@ func (c *Console) AutoCompleteInput(line string, pos int) (string, []string, str
244244
// console's available modules.
245245
func (c *Console) Welcome() {
246246
// Print some generic Geth metadata
247+
fmt.Fprintf(c.printer, "Welcome to the Geth JavaScript console!\n\n")
247248
c.jsre.Run(`
248-
(function () {
249-
console.log("Welcome to the Geth JavaScript console!\n");
250-
console.log("instance: " + web3.version.node);
251-
console.log("coinbase: " + eth.coinbase);
252-
console.log("at block: " + eth.blockNumber + " (" + new Date(1000 * eth.getBlock(eth.blockNumber).timestamp) + ")");
253-
console.log(" datadir: " + admin.datadir);
254-
})();
255-
`)
249+
console.log("instance: " + web3.version.node);
250+
console.log("coinbase: " + eth.coinbase);
251+
console.log("at block: " + eth.blockNumber + " (" + new Date(1000 * eth.getBlock(eth.blockNumber).timestamp) + ")");
252+
console.log(" datadir: " + admin.datadir);
253+
`)
256254
// List all the supported modules for the user to call
257255
if apis, err := c.client.SupportedModules(); err == nil {
258256
modules := make([]string, 0, len(apis))
259257
for api, version := range apis {
260258
modules = append(modules, fmt.Sprintf("%s:%s", api, version))
261259
}
262260
sort.Strings(modules)
263-
c.jsre.Run("(function () { console.log(' modules: " + strings.Join(modules, " ") + "'); })();")
261+
fmt.Fprintln(c.printer, " modules:", strings.Join(modules, " "))
264262
}
265-
c.jsre.Run("(function () { console.log(); })();")
263+
fmt.Fprintln(c.printer)
266264
}
267265

268266
// Evaluate executes code and pretty prints the result to the specified output

0 commit comments

Comments
 (0)