vendor/github.com/wraient/rich-go/ipc/ipc_windows.go
24 lines · 522 bytes
1//go:build windows
2// +build windows
3
4package ipc
5
6import (
7 "time"
8
9 npipe "gopkg.in/natefinch/npipe.v2"
10)
11
12// OpenSocket opens the discord-ipc-0 named pipe
13func OpenSocket() error {
14 // Connect to the Windows named pipe, this is a well known name
15 // We use DialTimeout since it will block forever (or very very long) on Windows
16 // if the pipe is not available (Discord not running)
17 sock, err := npipe.DialTimeout(`\\.\pipe\discord-ipc-0`, time.Second*2)
18 if err != nil {
19 return err
20 }
21
22 socket = sock
23 return nil
24}