forge icon indicating copy to clipboard operation
forge copied to clipboard

Allow setting `interactive: false` in the cli invocations

Open MOZGIII opened this issue 5 years ago • 1 comments

Preflight Checklist

  • [x] I have read the contribution documentation for this project.
  • [x] I agree to follow the code of conduct that this project follows, as appropriate.
  • [x] I have searched the issue tracker for a feature request that matches the one I want to file, without success.

Problem Description

I'd like to have an option to disable interactive mode. There are certain cases where it's impossible to properly recover from an error, and interactive: true mode cripples the terminal if not terminated properly.

Proposed Solution

Introduce an env var (preferable) or cli argument to disable the interactive mode.

Alternatives Considered

  • Proper handling of all the crashes. This is an ongoing process, however, it's impossible to cover all the edge cases (i.e. catch segfaults properly). While we improve the crash recovery logic, it's good to provide users an option to work around the issue. This is a very simple solution to a serious problem. Waiting until we to fix all the issues is waiting for a neverending thing - realistically, there will always be something that casues the process to crash.

  • Removing interactive mode altogether. This is a good thing in general, it is only when iterating under a certain condition ine would disable the interactive mode.

  • Ignore it and just do an external terminal reset. Not everyone is aware this is even possible, and it is very inconvenient. Simply disabling the the interactive mode would completely solve the issue though, and it would work for everyone.

Additional Information

Relevant code locations:

https://github.com/electron-userland/electron-forge/blob/6bd2bfcfe6d65d31bb08f2fcc244e65985964c45/packages/api/cli/src/electron-forge-lint.ts#L20

https://github.com/electron-userland/electron-forge/blob/6bd2bfcfe6d65d31bb08f2fcc244e65985964c45/packages/api/cli/src/electron-forge-import.ts#L20

https://github.com/electron-userland/electron-forge/blob/dcdc2a1cd70f16620c5f6cc5473baf0c0ea4aba7/packages/api/cli/src/electron-forge-init.ts#L23

https://github.com/electron-userland/electron-forge/blob/4c4e3d68aa21e33a9546395ed3d55afcd5b3f8c1/packages/api/cli/src/electron-forge-install.ts#L38

https://github.com/electron-userland/electron-forge/blob/4c4e3d68aa21e33a9546395ed3d55afcd5b3f8c1/packages/api/cli/src/electron-forge-install.ts#L38

https://github.com/electron-userland/electron-forge/blob/d65f33e73f5afe14597135755aa795edf6a818f2/packages/api/cli/src/electron-forge-publish.ts#L28

https://github.com/electron-userland/electron-forge/blob/d65f33e73f5afe14597135755aa795edf6a818f2/packages/api/cli/src/electron-forge-make.ts#L27

https://github.com/electron-userland/electron-forge/blob/abbf0311a4b615c2c3219256b3825eb638fc0f44/packages/api/cli/src/electron-forge-start.ts#L43

MOZGIII avatar Dec 28 '19 14:12 MOZGIII

@malept what do you think about this?

MOZGIII avatar Jan 21 '20 04:01 MOZGIII

With the migration to listr2, this is now possible via setting the DEBUG environment variable correctly.

E.g. DEBUG=electron-forge* yarn package will not output spinners and overwrite your error logs

MarshallOfSound avatar Nov 02 '22 19:11 MarshallOfSound

The problem is not with overwriting the errors or printing spinners, it's with the console input capturing, where the control commands are not properly handled.

MOZGIII avatar Nov 02 '22 20:11 MOZGIII

Indeed, I think this needs further consideration. I believe I'm experiencing an issue with the way electron forge handles terminal output. When working as expected my terminal output looks like this: image Then shortly after it becomes like this: image Note that this is not an issue with our logger - we use it for a number of projects, and we don't see this behavior with any of them.

RobertWHurst avatar May 08 '24 18:05 RobertWHurst