Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit 26829ff

Browse files
authored
Fixing resource warning for sqltoolsservice (#158)
* Fixing resource warning for sqltoolsservice by closing stdout after killing process. * Shortening sleep time during shutdown.
1 parent b893744 commit 26829ff

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mssqlscripter/main.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ def main(args):
105105
sql_tools_client.shutdown()
106106
tools_service_process.kill()
107107
# 1 second time out, allow tools service process to be killed.
108-
time.sleep(1)
108+
time.sleep(.1)
109+
# Close the stdout file handle or else we would get a resource warning (found via pytest).
110+
# This must be closed after the process is killed, otherwise we would block because the process is using
111+
# it's stdout.
112+
tools_service_process.stdout.close()
109113
# None value indicates process has not terminated.
110114
if not tools_service_process.poll():
111115
sys.stderr.write(

0 commit comments

Comments
 (0)