Skip to content

Commit 57efc14

Browse files
committed
Filter out control characters from lua error message
1 parent 0ed6fe3 commit 57efc14

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/util.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,9 @@ export abstract class TestBuilder {
252252
throw new Error(`Unsupported Lua return type: ${returnType}`);
253253
}
254254
} else {
255-
const message = to_jsstring(lua.lua_tostring(L, -1)).replace(/^\[string "--\.\.\."\]:\d+: /, "");
255+
// Filter out control characters appearing on some systems
256+
const luaStackString = lua.lua_tostring(L, -1).filter(c => c >= 20);
257+
const message = to_jsstring(luaStackString).replace(/^\[string "--\.\.\."\]:\d+: /, "");
256258
return new ExecutionError(message);
257259
}
258260
}

0 commit comments

Comments
 (0)