Skip to content

Commit d9fc0ed

Browse files
committed
Fix terminal errors
1 parent 626ee38 commit d9fc0ed

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/runner/runner.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,16 @@ export async function getEmulationWithStack(
366366
let gasRemaining = 0;
367367
let tryCatchError: { code: number; text: string } | undefined = undefined;
368368
const logs = txRes.result.vmLog;
369-
//console.log('vmlogs:', logs);
370369
const lines = logs.split('\n');
370+
let isStackAfter = (i: number) => {
371+
// go for all next lines until we find one starting with "stack:""
372+
for (let j = i + 1; j < lines.length; j++) {
373+
if (lines[j].startsWith('stack:')) {
374+
return true;
375+
}
376+
}
377+
return false;
378+
}
371379
for (let i = 0; i < lines.length; i++) {
372380
let line = lines[i];
373381
if (line.startsWith('execute')) {
@@ -440,7 +448,7 @@ export async function getEmulationWithStack(
440448
exitCode = Number(line.slice(57));
441449
explanation = line;
442450
}
443-
if (i === lines.length - 1) {
451+
if (!isStackAfter(i)) { // if last
444452
TVMResult.push({
445453
instruction,
446454
price: undefined,

0 commit comments

Comments
 (0)