mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
Add check chtext element and ids,fix quest problem
This commit is contained in:
1 parent
9da23b5dc1
commit
869f01a62b
11 files changed
+90
-78
No files matched your search
@@ -79,6 +79,16 @@ export async function deleteContainer(id) {
|
||||
await container.remove()
|
||||
}
|
||||
|
||||
function parseJSONOutput(data) {
|
||||
const { stream, error } = JSON.parse(data.toString())
|
||||
if (stream) {
|
||||
console.log(stream)
|
||||
}
|
||||
if (error) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
export function buildQuestImage(questPath, questId) {
|
||||
return new Promise((resolve, reject) => {
|
||||
engine.buildImage(
|
||||
@@ -97,13 +107,17 @@ export function buildQuestImage(questPath, questId) {
|
||||
}
|
||||
response.on('data', (data) => {
|
||||
// Process the data (this could be Docker build output)
|
||||
const { stream, error } = JSON.parse(data.toString())
|
||||
if (stream) {
|
||||
console.log(stream)
|
||||
}
|
||||
if (error) {
|
||||
console.error(error)
|
||||
reject(error)
|
||||
try {
|
||||
data
|
||||
.toString()
|
||||
.split('\n')
|
||||
.map((line) => line.trim())
|
||||
.filter((line) => line !== '')
|
||||
.forEach((line) => {
|
||||
parseJSONOutput(line.trim())
|
||||
})
|
||||
} catch (err) {
|
||||
reject(err)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user