Skip to content

Running child_process.fork without ELECTRON_RUN_AS_NODE #4520

@matteomonti

Description

@matteomonti

(I already asked about this on StackOverflow here and after a brief discussion I was suggested to propose this as a full-fledged issue.)
As far as my understanding goes, whenever I use child_process.fork from my main script to launch another script, the flag ELECTRON_RUN_AS_NODE will be set, so that the child process will just behave as a simple node environment. This means I will not be able to require electron, open windows, or do anything that electron does.
Is there a reason why users are not allowed to choose wether or not they would like to do GUI operations in the child process? If not, it would be great to allow users to possibly override the default set ELECTRON_RUN_AS_NODE and get windows and everything in the child process.
I was already suggested to use child_process.spawn on the electron executable, but that feels slightly dirty and also child_process.fork has a wonderful IPC interface that makes everything easy.

Would it be possible to do such a thing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions