Skip to content

Commit b261e95

Browse files
authored
Merge pull request #115 from yili1992/master
fix(socketserver): current workdir be modified when loop =True
2 parents 4272107 + c8bedac commit b261e95

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
------------------
33

44
* Dropped support for Python 3.4.
5+
56
* `#118 <https://github.com/pytest-dev/execnet/pull/118>`__: Fixed internal leak that should make
67
``execnet`` execute remote code in the main thread more often; previously it would sometimes
78
spawn a thread to execute a ``remote_exec`` call, even when the caller
@@ -10,6 +11,9 @@
1011
`pytest-dev/pytest-xdist#620 <https://github.com/pytest-dev/pytest-xdist/issues/620>`__
1112
for an example).
1213

14+
* `#115 <https://github.com/pytest-dev/execnet/pull/115>`__: Current working directory is now
15+
restored when calling ``script/socketserver.py``. The script now also loops by default
16+
when called from the command-line.
1317

1418
1.7.1 (2019-08-28)
1519
------------------

execnet/script/socketserver.py

Lines changed: 4 additions & 1 deletion
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:
@@ -126,7 +128,8 @@ def startserver(serversock, loop=False):
126128

127129
execmodel = get_execmodel("thread")
128130
serversock = bind_and_listen(hostport, execmodel)
129-
startserver(serversock, loop=False)
131+
startserver(serversock, loop=True)
132+
130133
elif __name__ == "__channelexec__":
131134
chan = globals()["channel"]
132135
execmodel = chan.gateway.execmodel

0 commit comments

Comments
 (0)