good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
27528ad3
Commit
27528ad3
authored
Oct 7, 2015
by
Jeffrey Wilcke
Browse files
Options
Downloads
Plain Diff
Merge pull request #1851 from bas-vk/historyfile
console/history respect datadir
parents
f8786def
8636f0e1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
cmd/geth/js.go
+6
-11
6 additions, 11 deletions
cmd/geth/js.go
cmd/geth/main.go
+1
-0
1 addition, 0 deletions
cmd/geth/main.go
with
7 additions
and
11 deletions
cmd/geth/js.go
+
6
−
11
View file @
27528ad3
...
@@ -145,7 +145,7 @@ func apiWordCompleter(line string, pos int) (head string, completions []string,
...
@@ -145,7 +145,7 @@ func apiWordCompleter(line string, pos int) (head string, completions []string,
return
begin
,
completionWords
,
end
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
:=
&
jsre
{
ps1
:
"> "
}
js
.
wait
=
make
(
chan
*
big
.
Int
)
js
.
wait
=
make
(
chan
*
big
.
Int
)
js
.
client
=
client
js
.
client
=
client
...
@@ -161,14 +161,14 @@ func newLightweightJSRE(libPath string, client comms.EthereumClient, interactive
...
@@ -161,14 +161,14 @@ func newLightweightJSRE(libPath string, client comms.EthereumClient, interactive
js
.
prompter
=
dumbterm
{
bufio
.
NewReader
(
os
.
Stdin
)}
js
.
prompter
=
dumbterm
{
bufio
.
NewReader
(
os
.
Stdin
)}
}
else
{
}
else
{
lr
:=
liner
.
NewLiner
()
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
)
lr
.
SetCtrlCAborts
(
true
)
js
.
loadAutoCompletion
()
js
.
loadAutoCompletion
()
lr
.
SetWordCompleter
(
apiWordCompleter
)
lr
.
SetWordCompleter
(
apiWordCompleter
)
lr
.
SetTabCompletionStyle
(
liner
.
TabPrints
)
lr
.
SetTabCompletionStyle
(
liner
.
TabPrints
)
js
.
prompter
=
lr
js
.
prompter
=
lr
js
.
atexit
=
func
()
{
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
()
lr
.
Close
()
close
(
js
.
wait
)
close
(
js
.
wait
)
}
}
...
@@ -203,14 +203,14 @@ func newJSRE(ethereum *eth.Ethereum, libPath, corsDomain string, client comms.Et
...
@@ -203,14 +203,14 @@ func newJSRE(ethereum *eth.Ethereum, libPath, corsDomain string, client comms.Et
js
.
prompter
=
dumbterm
{
bufio
.
NewReader
(
os
.
Stdin
)}
js
.
prompter
=
dumbterm
{
bufio
.
NewReader
(
os
.
Stdin
)}
}
else
{
}
else
{
lr
:=
liner
.
NewLiner
()
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
)
lr
.
SetCtrlCAborts
(
true
)
js
.
loadAutoCompletion
()
js
.
loadAutoCompletion
()
lr
.
SetWordCompleter
(
apiWordCompleter
)
lr
.
SetWordCompleter
(
apiWordCompleter
)
lr
.
SetTabCompletionStyle
(
liner
.
TabPrints
)
lr
.
SetTabCompletionStyle
(
liner
.
TabPrints
)
js
.
prompter
=
lr
js
.
prompter
=
lr
js
.
atexit
=
func
()
{
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
()
lr
.
Close
()
close
(
js
.
wait
)
close
(
js
.
wait
)
}
}
...
@@ -433,12 +433,7 @@ func hidepassword(input string) string {
...
@@ -433,12 +433,7 @@ func hidepassword(input string) string {
}
}
}
}
func
(
self
*
jsre
)
withHistory
(
op
func
(
*
os
.
File
))
{
func
(
self
*
jsre
)
withHistory
(
datadir
string
,
op
func
(
*
os
.
File
))
{
datadir
:=
common
.
DefaultDataDir
()
if
self
.
ethereum
!=
nil
{
datadir
=
self
.
ethereum
.
DataDir
}
hist
,
err
:=
os
.
OpenFile
(
filepath
.
Join
(
datadir
,
"history"
),
os
.
O_RDWR
|
os
.
O_CREATE
,
os
.
ModePerm
)
hist
,
err
:=
os
.
OpenFile
(
filepath
.
Join
(
datadir
,
"history"
),
os
.
O_RDWR
|
os
.
O_CREATE
,
os
.
ModePerm
)
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Printf
(
"unable to open history file: %v
\n
"
,
err
)
fmt
.
Printf
(
"unable to open history file: %v
\n
"
,
err
)
...
...
This diff is collapsed.
Click to expand it.
cmd/geth/main.go
+
1
−
0
View file @
27528ad3
...
@@ -429,6 +429,7 @@ func attach(ctx *cli.Context) {
...
@@ -429,6 +429,7 @@ func attach(ctx *cli.Context) {
repl
:=
newLightweightJSRE
(
repl
:=
newLightweightJSRE
(
ctx
.
GlobalString
(
utils
.
JSpathFlag
.
Name
),
ctx
.
GlobalString
(
utils
.
JSpathFlag
.
Name
),
client
,
client
,
ctx
.
GlobalString
(
utils
.
DataDirFlag
.
Name
),
true
,
true
,
)
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment