summaryrefslogtreecommitdiffstats
path: root/ssh.py
diff options
context:
space:
mode:
authorJoanna Wang <jojwang@google.com>2022-11-03 16:51:19 -0400
committerJoanna Wang <jojwang@google.com>2022-11-03 21:07:07 +0000
commita6c52f566acfbff5b0f37158c0d33adf05d250e5 (patch)
treed79d55b872c3be39c54dcb6ef41749c40d39ccf2 /ssh.py
parent0d130d2da0754c546f654ede99a79aac2b8e6c5f (diff)
downloadgit-repo-a6c52f566acfbff5b0f37158c0d33adf05d250e5.tar.gz
Set tracing to always on and save to .repo/TRACE_FILE.
- add `--trace_to_stderr` option so stderr will include trace outputs and any other errors that get sent to stderr - while TRACE_FILE will only include trace outputs piggy-backing on: https://gerrit-review.googlesource.com/c/git-repo/+/349154 Change-Id: I3895a84de4b2784f17fac4325521cd5e72e645e2 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/350114 Reviewed-by: LaMont Jones <lamontjones@google.com> Tested-by: Joanna Wang <jojwang@google.com>
Diffstat (limited to 'ssh.py')
-rw-r--r--ssh.py39
1 files changed, 20 insertions, 19 deletions
diff --git a/ssh.py b/ssh.py
index 450383dc..004fdbad 100644
--- a/ssh.py
+++ b/ssh.py
@@ -182,28 +182,29 @@ class ProxyManager:
182 # be important because we can't tell that that 'git@myhost.com' is the same 182 # be important because we can't tell that that 'git@myhost.com' is the same
183 # as 'myhost.com' where "User git" is setup in the user's ~/.ssh/config file. 183 # as 'myhost.com' where "User git" is setup in the user's ~/.ssh/config file.
184 check_command = command_base + ['-O', 'check'] 184 check_command = command_base + ['-O', 'check']
185 try: 185 with Trace('Call to ssh (check call): %s', ' '.join(check_command)):
186 Trace(': %s', ' '.join(check_command)) 186 try:
187 check_process = subprocess.Popen(check_command, 187 check_process = subprocess.Popen(check_command,
188 stdout=subprocess.PIPE, 188 stdout=subprocess.PIPE,
189 stderr=subprocess.PIPE) 189 stderr=subprocess.PIPE)
190 check_process.communicate() # read output, but ignore it... 190 check_process.communicate() # read output, but ignore it...
191 isnt_running = check_process.wait() 191 isnt_running = check_process.wait()
192 192
193 if not isnt_running: 193 if not isnt_running:
194 # Our double-check found that the master _was_ infact running. Add to 194 # Our double-check found that the master _was_ infact running. Add to
195 # the list of keys. 195 # the list of keys.
196 self._master_keys[key] = True 196 self._master_keys[key] = True
197 return True 197 return True
198 except Exception: 198 except Exception:
199 # Ignore excpetions. We we will fall back to the normal command and print 199 # Ignore excpetions. We we will fall back to the normal command and
200 # to the log there. 200 # print to the log there.
201 pass 201 pass
202 202
203 command = command_base[:1] + ['-M', '-N'] + command_base[1:] 203 command = command_base[:1] + ['-M', '-N'] + command_base[1:]
204 p = None
204 try: 205 try:
205 Trace(': %s', ' '.join(command)) 206 with Trace('Call to ssh: %s', ' '.join(command)):
206 p = subprocess.Popen(command) 207 p = subprocess.Popen(command)
207 except Exception as e: 208 except Exception as e:
208 self._master_broken.value = True 209 self._master_broken.value = True
209 print('\nwarn: cannot enable ssh control master for %s:%s\n%s' 210 print('\nwarn: cannot enable ssh control master for %s:%s\n%s'