]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Don't blast if cache couldn't be saved
authorvrana <jakubv@fb.com>
Wed, 13 Jun 2012 00:37:30 +0000 (17:37 -0700)
committervrana <jakubv@fb.com>
Wed, 13 Jun 2012 01:12:16 +0000 (18:12 -0700)
Summary:
It is currently causing us some pain because we use libraries in read-only directories.
Not saving the cache is still pretty bad because analysis is quite slow.
But it is better than exploding.

I considered other solutions like not .gitignoring the cache file but it would require committing it with each and every change.

I plan to resolve the note https://secure.phabricator.com/diffusion/ARC/browse/master/src/lint/linter/ArcanistPhutilLibraryLinter.php;d93bb5abd4935bc8$56-59 in longer term.

Test Plan: `arc liberate` without writable cache.

Reviewers: epriestley, nh

Reviewed By: epriestley

CC: aran, Korvin
Differential Revision: https://secure.phabricator.com/D2734

scripts/phutil_rebuild_map.php

index 53d5ee1a73a25afeb2180c12c89e41c4ac03a7bb..feec1e246a076e7b3d5258a542926b7e63591b59 100755 (executable)
@@ -407,7 +407,11 @@ final class PhutilLibraryMapBuilder {
     }
 
     $json = json_encode($cache);
-    Filesystem::writeFile($cache_file, $json);
+    try {
+      Filesystem::writeFile($cache_file, $json);
+    } catch (FilesystemException $ex) {
+      $this->log("Unable to save the cache!\n");
+    }
   }