Page MenuHomePhabricator

D10377.diff
No OneTemporary

D10377.diff

diff --git a/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php
--- a/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php
+++ b/src/applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php
@@ -128,7 +128,20 @@
DrydockResource $resource,
DrydockLease $lease) {
- // TODO: Remove leased directory
+ $cmd = $lease->getInterface('command');
+ $path = $lease->getAttribute('path');
+
+ try {
+ if ($resource->getAttribute('platform') !== 'windows') {
+ $cmd->execx('rm -rf %s', $path);
+ } else {
+ $cmd->execx('rm -Recurse -Force %s', $path);
+ }
+ } catch (Exception $ex) {
+ // We try to clean up, but sometimes files are locked or still in
+ // use (this is far more common on Windows). There's nothing we can
+ // do about this, so we ignore it.
+ }
}
protected function shouldCloseUnleasedResource(

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 17, 2:24 AM (21 h, 8 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6997911
Default Alt Text
D10377.diff (1 KB)

Event Timeline