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
db79143a
Unverified
Commit
db79143a
authored
Oct 24, 2019
by
Martin Holst Swende
Committed by
GitHub
Oct 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clef: resolve windows pipes, fixes #20121 (#20166)
parent
538f763f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
7 deletions
+23
-7
main.go
cmd/clef/main.go
+23
-7
No files found.
cmd/clef/main.go
View file @
db79143a
...
...
@@ -404,6 +404,27 @@ func initialize(c *cli.Context) error {
return
nil
}
// ipcEndpoint resolves an IPC endpoint based on a configured value, taking into
// account the set data folders as well as the designated platform we're currently
// running on.
func
ipcEndpoint
(
ipcPath
,
datadir
string
)
string
{
// On windows we can only use plain top-level pipes
if
runtime
.
GOOS
==
"windows"
{
if
strings
.
HasPrefix
(
ipcPath
,
`\\.\pipe\`
)
{
return
ipcPath
}
return
`\\.\pipe\`
+
ipcPath
}
// Resolve names into the data directory full paths otherwise
if
filepath
.
Base
(
ipcPath
)
==
ipcPath
{
if
datadir
==
""
{
return
filepath
.
Join
(
os
.
TempDir
(),
ipcPath
)
}
return
filepath
.
Join
(
datadir
,
ipcPath
)
}
return
ipcPath
}
func
signer
(
c
*
cli
.
Context
)
error
{
// If we have some unrecognized command, bail out
if
args
:=
c
.
Args
();
len
(
args
)
>
0
{
...
...
@@ -532,12 +553,8 @@ func signer(c *cli.Context) error {
}()
}
if
!
c
.
GlobalBool
(
utils
.
IPCDisabledFlag
.
Name
)
{
if
c
.
IsSet
(
utils
.
IPCPathFlag
.
Name
)
{
ipcapiURL
=
c
.
GlobalString
(
utils
.
IPCPathFlag
.
Name
)
}
else
{
ipcapiURL
=
filepath
.
Join
(
configDir
,
"clef.ipc"
)
}
givenPath
:=
c
.
GlobalString
(
utils
.
IPCPathFlag
.
Name
)
ipcapiURL
=
ipcEndpoint
(
filepath
.
Join
(
givenPath
,
"clef.ipc"
),
configDir
)
listener
,
_
,
err
:=
rpc
.
StartIPCEndpoint
(
ipcapiURL
,
rpcAPI
)
if
err
!=
nil
{
utils
.
Fatalf
(
"Could not start IPC api: %v"
,
err
)
...
...
@@ -547,7 +564,6 @@ func signer(c *cli.Context) error {
listener
.
Close
()
log
.
Info
(
"IPC endpoint closed"
,
"url"
,
ipcapiURL
)
}()
}
if
c
.
GlobalBool
(
testFlag
.
Name
)
{
...
...
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