summaryrefslogtreecommitdiff
path: root/source/slang/slang-spirv-val.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-spirv-val.cpp')
-rw-r--r--source/slang/slang-spirv-val.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/source/slang/slang-spirv-val.cpp b/source/slang/slang-spirv-val.cpp
index c2381fa0e..29a4b8617 100644
--- a/source/slang/slang-spirv-val.cpp
+++ b/source/slang/slang-spirv-val.cpp
@@ -21,24 +21,27 @@ static SlangResult disassembleSPIRV(const List<uint8_t>& spirv, String& outErr,
in->close();
// Wait for it to finish
- if(!p->waitForTermination(1000))
- return SLANG_FAIL;
-
- // TODO: allow inheriting stderr in Process
List<Byte> outData;
- SLANG_RETURN_ON_FAIL(StreamUtil::readAll(out, 0, outData));
- outErr = String(
- reinterpret_cast<const char*>(outData.begin()),
- reinterpret_cast<const char*>(outData.end())
- );
+ List<Byte> outErrData;
+ while (!out->isEnd() || !err->isEnd())
+ {
+ if (!out->isEnd())
+ StreamUtil::readAll(out, 0, outData);
+ if (!err->isEnd())
+ StreamUtil::readAll(err, 0, outErrData);
+ }
+ SLANG_RETURN_ON_FAIL(p->waitForTermination(10));
- outData.clear();
- SLANG_RETURN_ON_FAIL(StreamUtil::readAll(err, 0, outData));
outDis = String(
reinterpret_cast<const char*>(outData.begin()),
reinterpret_cast<const char*>(outData.end())
);
+ outErr = String(
+ reinterpret_cast<const char*>(outErrData.begin()),
+ reinterpret_cast<const char*>(outErrData.end())
+ );
+
const auto ret = p->getReturnValue();
return ret == 0 ? SLANG_OK : SLANG_FAIL;
}