This commit is contained in:
Kurt Hutten
2021-09-10 18:45:03 +10:00
parent da557a5c16
commit 12ab456446
3 changed files with 12 additions and 4 deletions

View File

@@ -36,7 +36,8 @@ export const runCQ = async ({
)
await runCommand(
`cat ${stlPath} /var/task/cadhub-concat-split /tmp/${tempFile}/metadata.json | gzip > ${fullPath}`,
15000, true
15000,
true
)
return { consoleMessage, fullPath }
} catch (error) {

View File

@@ -23,7 +23,11 @@ export async function writeFiles(
return tempFile
}
export async function runCommand(command, timeout = 5000, shouldRejectStdErr = false): Promise<string> {
export async function runCommand(
command,
timeout = 5000,
shouldRejectStdErr = false
): Promise<string> {
return new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => {
if (error) {
@@ -124,7 +128,9 @@ export async function storeAssetAndReturnUrl({
console.log('read file error', e)
const response = {
statusCode: 400,
body: Buffer.from(JSON.stringify({ error: consoleMessage, fullPath })).toString('base64'),
body: Buffer.from(
JSON.stringify({ error: consoleMessage, fullPath })
).toString('base64'),
isBase64Encoded: true,
}
callback(null, response)