changeset 49856:40d3ee570d83

watchman: refactor transport connecting to unconfuse pytype Pytype sees `self.proc` as potentially `None` here, even though it's set by the `_connect()` logic. Instead of asserting, simply use the process returned by that method (which it sets into `self.proc` before returning, so there's no functional change here).
author Matt Harbison <matt_harbison@yahoo.com>
date Thu, 05 Jan 2023 17:28:33 -0500
parents 36afe74e4439
children ab32fd8412a7
files hgext/fsmonitor/pywatchman/__init__.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/fsmonitor/pywatchman/__init__.py	Thu Jan 05 17:24:11 2023 -0500
+++ b/hgext/fsmonitor/pywatchman/__init__.py	Thu Jan 05 17:28:33 2023 -0500
@@ -689,9 +689,9 @@
         if self.closed:
             self.close()
             self.closed = False
-        self._connect()
-        res = self.proc.stdin.write(data)
-        self.proc.stdin.close()
+        proc = self._connect()
+        res = proc.stdin.write(data)
+        proc.stdin.close()
         self.closed = True
         return res