Skip to content

Commit 4a50d27

Browse files
yili1992nicoddemus
authored andcommitted
fix(socketserver): current workdir be modified when loop =True
1 parent 4272107 commit 4a50d27

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

execnet/script/socketserver.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def bind_and_listen(hostport, execmodel):
9494

9595

9696
def startserver(serversock, loop=False):
97+
execute_path = os.getcwd()
9798
try:
9899
while 1:
99100
try:
@@ -108,6 +109,7 @@ def startserver(serversock, loop=False):
108109
else:
109110
excinfo = sys.exc_info()
110111
print_("got exception", excinfo[1])
112+
os.chdir(execute_path)
111113
if not loop:
112114
break
113115
finally:
@@ -123,10 +125,10 @@ def startserver(serversock, loop=False):
123125
else:
124126
hostport = ":8888"
125127
from execnet.gateway_base import get_execmodel
126-
127128
execmodel = get_execmodel("thread")
128129
serversock = bind_and_listen(hostport, execmodel)
129-
startserver(serversock, loop=False)
130+
startserver(serversock, loop=True)
131+
130132
elif __name__ == "__channelexec__":
131133
chan = globals()["channel"]
132134
execmodel = chan.gateway.execmodel

0 commit comments

Comments
 (0)