Skip to content

Commit f3f7a89

Browse files
committed
make the JS autobuilder consistent with Ruby when no JS code was detected
1 parent cf7ebe2 commit f3f7a89

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

javascript/extractor/src/com/semmle/js/extractor/AutoBuild.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import com.semmle.util.exception.UserError;
5353
import com.semmle.util.extraction.ExtractorOutputConfig;
5454
import com.semmle.util.files.FileUtil;
55+
import com.semmle.util.files.FileUtil8;
5556
import com.semmle.util.io.WholeIO;
5657
import com.semmle.util.io.csv.CSVReader;
5758
import com.semmle.util.language.LegacyLanguage;
@@ -438,8 +439,10 @@ public int run() throws IOException {
438439
startThreadPool();
439440
try {
440441
extractSource();
441-
extractExterns();
442442
extractXml();
443+
if (seenCode) { // don't bother with the externs if no code was seen
444+
extractExterns();
445+
}
443446
} finally {
444447
shutdownThreadPool();
445448
}
@@ -449,7 +452,9 @@ public int run() throws IOException {
449452
} else {
450453
warn("No JavaScript or TypeScript code found.");
451454
}
452-
return -1;
455+
// ensuring that the finalize steps detects that no code was seen
456+
FileUtil8.recursiveDelete(Paths.get(EnvironmentVariables.getWipDatabase() + "/src"));
457+
return 0;
453458
}
454459
return 0;
455460
}

0 commit comments

Comments
 (0)