@@ -404,6 +404,27 @@ func initialize(c *cli.Context) error {
404404 return nil
405405}
406406
407+ // ipcEndpoint resolves an IPC endpoint based on a configured value, taking into
408+ // account the set data folders as well as the designated platform we're currently
409+ // running on.
410+ func ipcEndpoint (ipcPath , datadir string ) string {
411+ // On windows we can only use plain top-level pipes
412+ if runtime .GOOS == "windows" {
413+ if strings .HasPrefix (ipcPath , `\\.\pipe\` ) {
414+ return ipcPath
415+ }
416+ return `\\.\pipe\` + ipcPath
417+ }
418+ // Resolve names into the data directory full paths otherwise
419+ if filepath .Base (ipcPath ) == ipcPath {
420+ if datadir == "" {
421+ return filepath .Join (os .TempDir (), ipcPath )
422+ }
423+ return filepath .Join (datadir , ipcPath )
424+ }
425+ return ipcPath
426+ }
427+
407428func signer (c * cli.Context ) error {
408429 // If we have some unrecognized command, bail out
409430 if args := c .Args (); len (args ) > 0 {
@@ -532,12 +553,8 @@ func signer(c *cli.Context) error {
532553 }()
533554 }
534555 if ! c .GlobalBool (utils .IPCDisabledFlag .Name ) {
535- if c .IsSet (utils .IPCPathFlag .Name ) {
536- ipcapiURL = c .GlobalString (utils .IPCPathFlag .Name )
537- } else {
538- ipcapiURL = filepath .Join (configDir , "clef.ipc" )
539- }
540-
556+ givenPath := c .GlobalString (utils .IPCPathFlag .Name )
557+ ipcapiURL = ipcEndpoint (filepath .Join (givenPath , "clef.ipc" ), configDir )
541558 listener , _ , err := rpc .StartIPCEndpoint (ipcapiURL , rpcAPI )
542559 if err != nil {
543560 utils .Fatalf ("Could not start IPC api: %v" , err )
@@ -547,7 +564,6 @@ func signer(c *cli.Context) error {
547564 listener .Close ()
548565 log .Info ("IPC endpoint closed" , "url" , ipcapiURL )
549566 }()
550-
551567 }
552568
553569 if c .GlobalBool (testFlag .Name ) {
0 commit comments