Skip to content

Commit 94c0449

Browse files
committed
fix: docker runtime fail because stdout columns
1 parent 6603c45 commit 94c0449

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/backend/src/fun/dev-console-ui-utils.js

+17
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,23 @@ const surrounding_box = (col, lines, lengths) => {
1515
lengths = lines.map(line => stringLength(line));
1616
}
1717

18+
const probably_docker = (() => {
19+
try {
20+
// I don't know what the value of this is in Docker,
21+
// but what I do know is it'll throw an exception
22+
// when I do this to it.
23+
Array(process.stdout.columns - 1);
24+
} catch (e) {
25+
return true;
26+
}
27+
})();
28+
29+
if ( probably_docker ) {
30+
// We just won't try to render any decoration on Docker;
31+
// it's not worth potentially breaking the output.
32+
return;
33+
}
34+
1835
const max_length = process.stdout.columns - 6;
1936
// const max_length = Math.max(...lengths);
2037

0 commit comments

Comments
 (0)