File tree 1 file changed +9
-0
lines changed
contrib/pyln-client/pyln/client
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 3
3
import os
4
4
import socket
5
5
import sys
6
+ import tempfile
6
7
from contextlib import contextmanager
7
8
from decimal import Decimal
8
9
from json import JSONEncoder
@@ -256,6 +257,14 @@ def connect(self) -> None:
256
257
short_path = "/proc/self/fd/%d/%s" % (dirfd , basename )
257
258
self .sock = socket .socket (socket .AF_UNIX , socket .SOCK_STREAM )
258
259
self .sock .connect (short_path )
260
+ elif (e .args [0 ] == "AF_UNIX path too long" and os .uname ()[0 ] == "Darwin" ):
261
+ temp_dir = tempfile .mkdtemp ()
262
+ temp_link = os .path .join (temp_dir , "socket_link" )
263
+ if os .path .exists (temp_link ):
264
+ os .unlink (temp_link )
265
+ os .symlink (self .path , temp_link )
266
+ self .sock = socket .socket (socket .AF_UNIX , socket .SOCK_STREAM )
267
+ self .sock .connect (temp_link )
259
268
else :
260
269
# There is no good way to recover from this.
261
270
raise
You can’t perform that action at this time.
0 commit comments