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

always verbose output. #594

Closed
serkanyersen opened this issue Jan 29, 2021 · 10 comments · Fixed by #832
Closed

always verbose output. #594

serkanyersen opened this issue Jan 29, 2021 · 10 comments · Fixed by #832
Labels

Comments

@serkanyersen
Copy link

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.

@mmaietta
Copy link
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

@serkanyersen
Copy link
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 :)

mmaietta added a commit to mmaietta/electron-rebuild that referenced this issue May 9, 2021
Updating logic to not rely on DEBUG env var, but instead use the debug module to check if electron-rebuild is enabled
electron#594
mmaietta added a commit to mmaietta/electron-rebuild that referenced this issue Jun 1, 2021
Updating logic to not rely on DEBUG env var, but instead use the debug module to check if electron-rebuild is enabled
electron#594
@electron-bot
Copy link

🎉 This issue has been resolved in version 3.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@serkanyersen
Copy link
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?

@malept
Copy link
Member

malept commented Aug 27, 2021

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.

@serkanyersen
Copy link
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.

@serkanyersen
Copy link
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.

@serkanyersen
Copy link
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.

@malept
Copy link
Member

malept commented Aug 27, 2021

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.

@serkanyersen
Copy link
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
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants