Skip to content

Commit f7c79c9

Browse files
committed
Quit oid when upload/download is requested but cache is disabled
1 parent 675211a commit f7c79c9

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/OID.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ static ExitStatus::ExitStatus runScript(const std::string& fileName,
293293

294294
oid->setCacheRemoteEnabled(oidConfig.cacheRemoteUpload,
295295
oidConfig.cacheRemoteDownload);
296+
if (!oid->validateCache()) {
297+
return ExitStatus::UsageError;
298+
}
296299
oid->setCustomCodeFile(oidConfig.customCodeFile);
297300
oid->setEnableJitLogging(oidConfig.enableJitLogging);
298301
oid->setGenerateJitDebugInfo(oidConfig.generateJitDebug);

src/OIDebugger.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
#pragma once
1717

18+
#include <glog/logging.h>
19+
1820
#include <filesystem>
1921
#include <fstream>
2022

@@ -86,6 +88,15 @@ class OIDebugger {
8688
cache.abortOnLoadFail = download && !upload;
8789
}
8890

91+
bool validateCache() {
92+
if ((cache.enableUpload || cache.enableDownload) && !cache.isEnabled()) {
93+
LOG(ERROR) << "Cache download/upload option specified when cache is "
94+
"disabled - aborting!";
95+
return false;
96+
}
97+
return true;
98+
}
99+
89100
void setHardDisableDrgn(bool val) {
90101
symbols->setHardDisableDrgn(val);
91102
}

0 commit comments

Comments
 (0)