Skip to content

Commit d23bbf4

Browse files
authored
SWDEV-480258 - hipcc stop using temp file (llvm#1184)
2 parents f103d46 + 15bac0f commit d23bbf4

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

amd/hipcc/src/hipBin_base.h

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -466,26 +466,13 @@ void HipBinBase::printUsage() const {
466466

467467
// compiler canRun or not
468468
bool HipBinBase::canRunCompiler(string exeName, string& cmdOut) {
469-
string compilerName = exeName;
470-
string temp_dir = hipBinUtilPtr_->getTempDir();
471-
fs::path templateFs = temp_dir;
472-
templateFs /= "canRunXXXXXX";
473-
string tmpFileName = hipBinUtilPtr_->mktempFile(templateFs.string());
474-
compilerName += " --version > " + tmpFileName + " 2>&1";
475469
bool executable = false;
476-
if (system(const_cast<char*>(compilerName.c_str()))) {
470+
SystemCmdOut sysOut = hipBinUtilPtr_->exec((exeName + " --version").c_str());
471+
if (sysOut.exitCode != 0) {
477472
executable = false;
478473
} else {
479-
string myline;
480-
ifstream fp;
481-
fp.open(tmpFileName);
482-
if (fp.is_open()) {
483-
while (std::getline(fp, myline)) {
484-
cmdOut += myline;
485-
}
486-
}
487-
fp.close();
488474
executable = true;
475+
cmdOut += sysOut.out;
489476
}
490477
return executable;
491478
}

0 commit comments

Comments
 (0)