Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Using stderr pipe w/ cross-spawn of rspack process breaks indicatif::ProgressBar (v1.0.5 --> v1.0.6) #8690

Open
BrunoRDS opened this issue Dec 12, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@BrunoRDS
Copy link

BrunoRDS commented Dec 12, 2024

System Info

System:
OS: Linux 6.5 Ubuntu 20.04.6 LTS (Focal Fossa)
CPU: (32) x64 AMD EPYC 7763 64-Core Processor
Memory: 116.94 GB / 125.78 GB
Container: Yes
Shell: 5.0.17 - /bin/bash
Binaries:
Node: 20.11.0 - /usr/local/share/nvm/versions/node/v20.11.0/bin/node
Yarn: 1.23.19 - /usr/bin/yarn
npm: 10.2.4 - /usr/local/share/nvm/versions/node/v20.11.0/bin/npm
Watchman: 20240317.093234.0 - /usr/local/bin/watchman
Browsers:
Chrome: 131.0.6778.108

Details

Upgrading from v1.0.5 to v1.0.6 I have seen a regression in support of the default indicatif::ProgressBar when setting stdio:stderr = "pipe".

We use the stderr to log error console output to centralized telemetry datastore In version v1.0.5 there was no issue. After upgrading to v1.0.6+ we are no longer seeing the progress bar.

It would seem connected to this commit: fc3b9fa#diff-072b4d3aedf8b9301d9451a9691bb6315a54c6b5d9ebe1a3d1c1e8792f6a4f94R41
@LingyuCoder

We have the following setup:

  const spawn = require("cross-spawn");
  const spawnOptions = {
    cwd: process.cwd(),
    stdio: mode === "development" ? ["inherit", "inherit", "pipe"] : "inherit",
    env,
  };

  const proc = spawn("rspack", args, spawnOptions);
  proc.on("close", () => process.exit(0));

  if (mode === "development") {
    const stderrBuffer = [];

    // ensure errors are displayed in console
    proc.stderr.setEncoding("utf-8");
    proc.stderr.pipe(process.stderr);

    // success logs for yarnStart will never reach to here, only failures.
    proc.on("exit", code => {
      if (code !== 0) {
        // log error and exit.
        // limit buffer size
        const eventMessage = stderrBuffer.reverse().join("").slice(0, 5000);
        // send eventMessage and other data to telemetry datastore here.
      }
    });
  }

again the above works w/ the progress bar visible up to v1.0.5

Reproduce link

Repro Fork of rspack-repro: https://github.com/BrunoRDS/rspack-repro-no-progress

Reproduce Steps

... see below

@BrunoRDS BrunoRDS added bug Something isn't working pending triage The issue/PR is currently untouched. labels Dec 12, 2024
@BrunoRDS BrunoRDS changed the title [Bug]: Using stderr pipe w/ cross-spawn swawn of rspack process break indicatif::ProgressBar (v1.0.5 --> v1.0.6) [Bug]: Using stderr pipe w/ cross-spawn of rspack process break indicatif::ProgressBar (v1.0.5 --> v1.0.6) Dec 12, 2024
@BrunoRDS BrunoRDS changed the title [Bug]: Using stderr pipe w/ cross-spawn of rspack process break indicatif::ProgressBar (v1.0.5 --> v1.0.6) [Bug]: Using stderr pipe w/ cross-spawn of rspack process breaks indicatif::ProgressBar (v1.0.5 --> v1.0.6) Dec 12, 2024
Copy link
Contributor

Hello @BrunoRDS, sorry we can't investigate the problem further without reproduction demo, please provide a repro demo by forking rspack-repro, or provide a minimal GitHub repository by yourself. Issues labeled by need reproduction will be closed if no activities in 14 days.

@BrunoRDS
Copy link
Author

BrunoRDS commented Dec 16, 2024

Repro Fork of rspack-repro: https://github.com/BrunoRDS/rspack-repro-no-progress

Repro Repo setup:

  1. Add the following to the PATH in your ~/.bashrc
export PATH="/workspaces/rspack-repro-no-progress/node_modules/@rspack/cli/bin:/workspaces/rspack-repro-no-progress/.yarn/releases:$PATH"
alias rspack='/workspaces/rspack-repro-no-progress/node_modules/@rspack/cli/bin/rspack'
alias yarn='/workspaces/rspack-repro-no-progress/.yarn/releases/yarn'
  1. nvm install 20.11.0

  2. nvm use 20.11.0

  3. sudo yarn install

  4. Try sudo yarn start with these two versions for @rspack/core and @rspack/cli and observe the absence of the progress bar on v1.1.0+ (git clean -fdx & sudo yarn install after each version change in the package.json)

v1.1.0-beta.0:

Image

v1.1.0

Image

I see the issue arise in this repro in a different version than I do in my project but it might just be due to a mix of rspack versions in my project due to nested projects in my repo requiring different version of @rspack/core & @rspack/cli ... the repro is the same behavior I see locally in my project.

@inottn

NOTE: We use a fork of yarn classic midgard-yarn v1.23.34, that is what has been added under the .yarn directory.

@LingyuCoder LingyuCoder self-assigned this Dec 18, 2024
@LingyuCoder LingyuCoder removed the pending triage The issue/PR is currently untouched. label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants