| 88 | return request |
| 89 | |
| 90 | def shutdown(self): |
| 91 | self.json_rpc_client.shutdown() |
| 92 | |
| 93 | if self.tools_service_process: |
| 94 | logger.info(u'Shutting down Sql Tools Client Process Id: %s', |
| 95 | self.tools_service_process.pid) |
| 96 | |
| 97 | try: |
| 98 | # kill process and give it time to die |
| 99 | self.tools_service_process.kill() |
| 100 | time.sleep(0.1) |
| 101 | except OSError: |
| 102 | # catches 'No such process' error from Python 2 |
| 103 | pass |
| 104 | finally: |
| 105 | # Close the stdout file handle or else we would get a resource warning (found via |
| 106 | # pytest). This must be closed after the process is killed, otherwise we would block |
| 107 | # because the process is using it's stdout. |
| 108 | self.tools_service_process.stdout.close() |
| 109 | # None value indicates process has not terminated. |
| 110 | if not self.tools_service_process.poll(): |
| 111 | logger.warning( |
| 112 | u'\nSql Tools Service process was not shut down properly.') |