Have redbean Lua repl show utf-8 when it's valid

Otherwise EncodeLua() will assume strings are binary and display them
using hex sequences.
This commit is contained in:
Justine Tunney 2022-07-23 06:47:01 -07:00
parent 31e4b0867b
commit ce5cb8a2f8
10 changed files with 217 additions and 35 deletions

View file

@ -31,6 +31,7 @@
#include "libc/fmt/fmt.h"
#include "libc/fmt/itoa.h"
#include "libc/intrin/kprintf.h"
#include "libc/intrin/promises.internal.h"
#include "libc/log/backtrace.internal.h"
#include "libc/log/color.internal.h"
#include "libc/log/log.h"
@ -65,6 +66,10 @@ static int PrintBacktraceUsingAddr2line(int fd, const struct StackFrame *bp) {
char *debugbin, *p1, *p2, *p3, *addr2line;
char buf[kBacktraceBufSize], *argv[kBacktraceMaxFrames];
if (!PLEDGED(STDIO) || !PLEDGED(EXEC) || !PLEDGED(EXEC)) {
return -1;
}
if (!(debugbin = FindDebugBinary())) {
return -1;
}