Skip to content

always verbose output. #594

Closed
Closed

Description

@serkanyersen

After upgrading to #400 our build outputs are always verbose now. we use the node api like this.

import rebuild from 'electron-rebuild';

rebuild({
  ...
})

I tried few things but can't suppress the node-gyp output. I tried setting the log-level to silent through npm env vars, it helps a little but still bunch of logs are printed out.

Any way to make rebuilds quiet? I made sure process.env.DEBUG is not set.

Activity

  1. mmaietta commented on Apr 19, 2021

    @mmaietta
    Contributor

    I created this patch for electron-rebuild's output (options available: verbose, silent, warn, silly)
    electron-rebuild+2.3.5.patch

    diff --git a/node_modules/electron-rebuild/lib/src/module-rebuilder.js b/node_modules/electron-rebuild/lib/src/module-rebuilder.js
    index 73ddba1..5f3f7c3 100644
    --- a/node_modules/electron-rebuild/lib/src/module-rebuilder.js
    +++ b/node_modules/electron-rebuild/lib/src/module-rebuilder.js
    @@ -70,9 +70,7 @@ class ModuleRebuilder {
                 `--dist-url=${this.rebuilder.headerURL}`,
                 '--build-from-source'
             ];
    -        if (process.env.DEBUG) {
    -            args.push('--verbose');
    -        }
    +        args.push(`--loglevel=${debug.enabled('electron-rebuild') ? 'verbose' : 'silent'}`)
             if (this.rebuilder.debug) {
                 args.push('--debug');
             }
    

    The downside is that we can't filter the verbosity of make, which is what I'm understanding to be the main culprit here. Ref: nodejs/node-gyp#532

  2. serkanyersen commented on Apr 20, 2021

    @serkanyersen
    Author

    @mmaietta Thanks for this patch, like you said it doesn't actually fix the issue, but it reduces the verbosity a little bit.

    It also makes more sense than using process.env.DEBUG directly. currently electron-rebuild will be set to verbose even if I try to debug other libraries. export DEBUG=babel for example.

    I suggest you turn your patch into a pull request :)

  3. added 2 commits that reference this issue on Aug 24, 2021
    9cc4840
    8af613f
  4. added a commit that references this issue on Aug 27, 2021
    866be75
  5. electron-bot commented on Aug 27, 2021

    @electron-bot

    🎉 This issue has been resolved in version 3.2.1 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  6. serkanyersen commented on Aug 27, 2021

    @serkanyersen
    Author

    @malept Thanks for merging and releasing this fix 🎉

    However, this fix only helps a little bit, actual problem is still there. Webpack build output is still showing lines like this.

    Screen Shot 2021-08-27 at 10 14 14 AM

    and there is no way to suppress that output. Should we re-open this issue until a solution is found?

  7. malept commented on Aug 27, 2021

    @malept
    Member

    You're probably not using the latest version of electron-rebuild. Electron Forge v6 beta 60 will have this latest version by default but I don't have a timeline for when that will be released.

  8. serkanyersen commented on Aug 27, 2021

    @serkanyersen
    Author

    we are using electron-rebuild directly and I upgraded to v3.2.1 (confirmed in yarn.lock, no other version is there)

    Here is how it's used in our code

    import rebuild from 'electron-rebuild';
    
    await rebuild({
      arch,
      buildPath: working,
      electronVersion: config.electronVersion,
      force: true,
      debug: argv.electronDebug, // false
    });

    it's possible that we are doing something wrong of course.

  9. serkanyersen commented on Aug 27, 2021

    @serkanyersen
    Author

    I was just checking how node-gyp is used, I noticed this

    https://github.com/electron/electron-rebuild/blob/master/src/module-type/node-gyp.ts#L27 this line uses --quiet but it needs to be --silent

    After that change, output is reduced to this

    Screen Shot 2021-08-27 at 11 07 30 AM

    I'm investigating where these additional lines are coming from, it could be a bug with node-gyp it seems to me that it's not respecting --silent flag.

  10. serkanyersen commented on Aug 27, 2021

    @serkanyersen
    Author

    yes, this is happening because of node-gyp here node gyp sets the stdio for the childProcess to be inherit=[0, 1, 2] on silent. if I set this to ['ignore', 'ignore', 'ignore'] all output is suppressed. not sure how to approach this as a fix.

  11. malept commented on Aug 27, 2021

    @malept
    Member

    this line uses --quiet but it needs to be --silent

    Thanks, I've fixed that in #837.

    yes, this is happening because of node-gyp here node gyp sets the stdio for the childProcess to be inherit=[0, 1, 2] on silent. if I set this to ['ignore', 'ignore', 'ignore'] all output is suppressed. not sure how to approach this as a fix.

    This sounds like something that needs to be fixed in node-gyp.

  12. serkanyersen commented on Aug 27, 2021

    @serkanyersen
    Author

    Thanks for prompt reply @malept. I've created local patches for these and will create an issue on node-gyp at one point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions