3824: Check whether there is anything to install before trying to lock $destdir.
authorTom Clegg <tom@curoverse.com>
Mon, 17 Nov 2014 15:55:59 +0000 (10:55 -0500)
committerTom Clegg <tom@curoverse.com>
Mon, 17 Nov 2014 15:55:59 +0000 (10:55 -0500)
sdk/cli/bin/crunch-job

index 7205382211bd3cda6ac98b4fa5fea184030129ae..0d35d53f9d2b924ea8b583fda5b5a3a682be09fb 100755 (executable)
@@ -1753,6 +1753,11 @@ if ($task_work) {
   remove_tree($task_work, {keep_root => 1});
 }
 
+my @git_archive_data = <DATA>;
+if (!@git_archive_data) {
+  # Nothing to extract -> nothing to install.
+  run_argv_and_exit();
+}
 
 open L, ">", "$destdir.lock" or die "$destdir.lock: $!";
 flock L, LOCK_EX;
@@ -1767,12 +1772,6 @@ open STDOUT, ">", "$destdir.log";
 open STDERR, ">&STDOUT";
 
 mkdir $destdir;
-my @git_archive_data = <DATA>;
-if (!@git_archive_data) {
-  # Nothing to extract -> nothing to install.
-  run_argv_and_exit();
-}
-
 open TARX, "|-", "tar", "-C", $destdir, "-xf", "-";
 print TARX @git_archive_data;
 if(!close(TARX)) {