From 94c0449437ce4cb26d00a15a3f277bc7b09367b4 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Mon, 8 Jul 2024 00:31:18 -0400 Subject: [PATCH] fix: docker runtime fail because stdout columns --- src/backend/src/fun/dev-console-ui-utils.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/backend/src/fun/dev-console-ui-utils.js b/src/backend/src/fun/dev-console-ui-utils.js index 0956ae5e..c30a358c 100644 --- a/src/backend/src/fun/dev-console-ui-utils.js +++ b/src/backend/src/fun/dev-console-ui-utils.js @@ -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);