From 6342b5ca87730c7550520933a2f7bb2299f49fcc Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Wed, 22 Jan 2025 12:25:16 +0530 Subject: [PATCH] feat(lib): write progress bars to stderr --- toolchainlib/src/init.luau | 2 +- toolchainlib/src/utils/progress.luau | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/toolchainlib/src/init.luau b/toolchainlib/src/init.luau index cdf1173..d5adf88 100644 --- a/toolchainlib/src/init.luau +++ b/toolchainlib/src/init.luau @@ -281,7 +281,7 @@ function installTool(tool: ToolId, installPath: pathfs.Path): number if matchingAsset == nil then if _G.interactive then -- Clear the current progress bar line - stdio.write("\x1b[2K\x1b[0G") + stdio.ewrite("\x1b[2K\x1b[0G") end -- Output warnings diff --git a/toolchainlib/src/utils/progress.luau b/toolchainlib/src/utils/progress.luau index 25743c9..cf0679c 100644 --- a/toolchainlib/src/utils/progress.luau +++ b/toolchainlib/src/utils/progress.luau @@ -56,7 +56,7 @@ function ProgressBar.start(self: ProgressBarImpl): () while not self.finished do for _, spinner in SPINNERS do local stage = self.stages[self.currentStageIndex] - stdio.write( + stdio.ewrite( `\x1b[2K\x1b[0G{stdio.color("cyan")}{spinner} {stage.message}{stdio.color("reset")}{string.rep( " ", MAX_MESSAGE_LENGTH - #stage.message