Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
27528ad3
Commit
27528ad3
authored
Oct 07, 2015
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1851 from bas-vk/historyfile
console/history respect datadir
parents
f8786def
8636f0e1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
11 deletions
+7
-11
js.go
cmd/geth/js.go
+6
-11
main.go
cmd/geth/main.go
+1
-0
No files found.
cmd/geth/js.go
View file @
27528ad3
...
...
@@ -145,7 +145,7 @@ func apiWordCompleter(line string, pos int) (head string, completions []string,
return
begin
,
completionWords
,
end
}
func
newLightweightJSRE
(
libPath
string
,
client
comms
.
EthereumClient
,
interactive
bool
)
*
jsre
{
func
newLightweightJSRE
(
libPath
string
,
client
comms
.
EthereumClient
,
datadir
string
,
interactive
bool
)
*
jsre
{
js
:=
&
jsre
{
ps1
:
"> "
}
js
.
wait
=
make
(
chan
*
big
.
Int
)
js
.
client
=
client
...
...
@@ -161,14 +161,14 @@ func newLightweightJSRE(libPath string, client comms.EthereumClient, interactive
js
.
prompter
=
dumbterm
{
bufio
.
NewReader
(
os
.
Stdin
)}
}
else
{
lr
:=
liner
.
NewLiner
()
js
.
withHistory
(
func
(
hist
*
os
.
File
)
{
lr
.
ReadHistory
(
hist
)
})
js
.
withHistory
(
datadir
,
func
(
hist
*
os
.
File
)
{
lr
.
ReadHistory
(
hist
)
})
lr
.
SetCtrlCAborts
(
true
)
js
.
loadAutoCompletion
()
lr
.
SetWordCompleter
(
apiWordCompleter
)
lr
.
SetTabCompletionStyle
(
liner
.
TabPrints
)
js
.
prompter
=
lr
js
.
atexit
=
func
()
{
js
.
withHistory
(
func
(
hist
*
os
.
File
)
{
hist
.
Truncate
(
0
);
lr
.
WriteHistory
(
hist
)
})
js
.
withHistory
(
datadir
,
func
(
hist
*
os
.
File
)
{
hist
.
Truncate
(
0
);
lr
.
WriteHistory
(
hist
)
})
lr
.
Close
()
close
(
js
.
wait
)
}
...
...
@@ -203,14 +203,14 @@ func newJSRE(ethereum *eth.Ethereum, libPath, corsDomain string, client comms.Et
js
.
prompter
=
dumbterm
{
bufio
.
NewReader
(
os
.
Stdin
)}
}
else
{
lr
:=
liner
.
NewLiner
()
js
.
withHistory
(
func
(
hist
*
os
.
File
)
{
lr
.
ReadHistory
(
hist
)
})
js
.
withHistory
(
ethereum
.
DataDir
,
func
(
hist
*
os
.
File
)
{
lr
.
ReadHistory
(
hist
)
})
lr
.
SetCtrlCAborts
(
true
)
js
.
loadAutoCompletion
()
lr
.
SetWordCompleter
(
apiWordCompleter
)
lr
.
SetTabCompletionStyle
(
liner
.
TabPrints
)
js
.
prompter
=
lr
js
.
atexit
=
func
()
{
js
.
withHistory
(
func
(
hist
*
os
.
File
)
{
hist
.
Truncate
(
0
);
lr
.
WriteHistory
(
hist
)
})
js
.
withHistory
(
ethereum
.
DataDir
,
func
(
hist
*
os
.
File
)
{
hist
.
Truncate
(
0
);
lr
.
WriteHistory
(
hist
)
})
lr
.
Close
()
close
(
js
.
wait
)
}
...
...
@@ -433,12 +433,7 @@ func hidepassword(input string) string {
}
}
func
(
self
*
jsre
)
withHistory
(
op
func
(
*
os
.
File
))
{
datadir
:=
common
.
DefaultDataDir
()
if
self
.
ethereum
!=
nil
{
datadir
=
self
.
ethereum
.
DataDir
}
func
(
self
*
jsre
)
withHistory
(
datadir
string
,
op
func
(
*
os
.
File
))
{
hist
,
err
:=
os
.
OpenFile
(
filepath
.
Join
(
datadir
,
"history"
),
os
.
O_RDWR
|
os
.
O_CREATE
,
os
.
ModePerm
)
if
err
!=
nil
{
fmt
.
Printf
(
"unable to open history file: %v
\n
"
,
err
)
...
...
cmd/geth/main.go
View file @
27528ad3
...
...
@@ -429,6 +429,7 @@ func attach(ctx *cli.Context) {
repl
:=
newLightweightJSRE
(
ctx
.
GlobalString
(
utils
.
JSpathFlag
.
Name
),
client
,
ctx
.
GlobalString
(
utils
.
DataDirFlag
.
Name
),
true
,
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment