fix: docker runtime fail because stdout columns

This commit is contained in:
KernelDeimos 2024-07-08 00:31:18 -04:00
parent 6603c45093
commit 94c0449437

View File

@ -15,6 +15,23 @@ const surrounding_box = (col, lines, lengths) => {
lengths = lines.map(line => stringLength(line));
}
const probably_docker = (() => {
try {
// I don't know what the value of this is in Docker,
// but what I do know is it'll throw an exception
// when I do this to it.
Array(process.stdout.columns - 1);
} catch (e) {
return true;
}
})();
if ( probably_docker ) {
// We just won't try to render any decoration on Docker;
// it's not worth potentially breaking the output.
return;
}
const max_length = process.stdout.columns - 6;
// const max_length = Math.max(...lengths);