mirror of
https://github.com/facebook/sapling.git
synced 2024-10-04 13:57:13 +03:00
Back out "Back out "eden rm: Stop adb server / buck2""
Summary: Undo backout (this diff wasn't the one that introduced the regression) Reviewed By: kmancini Differential Revision: D56883957 fbshipit-source-id: 034eead51816bf5ca6ee97fecb15fdd40e8c1fb8
This commit is contained in:
parent
a68bac812f
commit
3248bf896f
@ -994,8 +994,10 @@ trouble cleaning up leftovers. You will need to manually remove {path}.
|
|||||||
)
|
)
|
||||||
|
|
||||||
if used_by_other:
|
if used_by_other:
|
||||||
winhr = WinFileHandlerReleaser()
|
# Use the hammer
|
||||||
winhr.try_release(path)
|
winhr = WinFileHandlerReleaser(self)
|
||||||
|
winhr.stop_adb_server()
|
||||||
|
winhr.stop_buck2()
|
||||||
|
|
||||||
raise errors[0][1]
|
raise errors[0][1]
|
||||||
|
|
||||||
|
@ -222,3 +222,42 @@ if sys.platform == "win32":
|
|||||||
frs.exception_raised = e
|
frs.exception_raised = e
|
||||||
frs.log_release_outcome(False)
|
frs.log_release_outcome(False)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
def stop_adb_server(self) -> None:
|
||||||
|
"""adb (Android Debug Bridge) is a usual suspect hanging on to directories.
|
||||||
|
Terminating it is harmless; it will be restarted on demand.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
subprocess.check_output(
|
||||||
|
[
|
||||||
|
"adb",
|
||||||
|
"kill-server",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
except FileNotFoundError:
|
||||||
|
# adb is not installed, no need to stop it.
|
||||||
|
pass
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
# Note that if adb-server is not running the error code will still be 0 (and a message written to console),
|
||||||
|
# but just in case there's any other cases, log error codes.
|
||||||
|
print(f"adb returned {e.errorcode} when trying to stop adb server.")
|
||||||
|
|
||||||
|
def stop_buck2(self) -> None:
|
||||||
|
"""buck2 server seems to like cwd'ing into places and staying there.
|
||||||
|
Terminating it is harmless; it will be restarted on demand.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
subprocess.check_output(
|
||||||
|
[
|
||||||
|
"buck2",
|
||||||
|
"kill",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
except FileNotFoundError:
|
||||||
|
# buck2d is not installed
|
||||||
|
print("buck2 not found, this system might be really broken.")
|
||||||
|
pass
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
# Note that if buck2 server is not running the error code will still be 0 (and a message written to console),
|
||||||
|
# but just in case there's any other cases, log error codes.
|
||||||
|
print(f"buck2 returned {e.errorcode} when trying to stop buckd server.")
|
||||||
|
Loading…
Reference in New Issue
Block a user