-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Unable to access electron features #2162
Comments
I am aware of one single IPC message between the backend and the client; please check your generated // ...
address.then(function (address) {
if (process && process.send) {
process.send(address.port.toString());
}
});
// ... and the generated // ...
const cp = fork(mainPath);
cp.on('message', (message) => {
loadMainWindow(message);
});
// ... |
Thanks. OK, so the inability to access electron from the backend of an electron extension is expected? Forgive me if I'm missing something, but I'm having difficulty creating a mental map of this. It would be really useful if the architecture docs could reflect these models. |
Hi, ideally we would allow it, but while working on the dynamic extension system we had to separate (via the cluster module) the server code to allow install/uninstall extensions at runtime, for example that we don't kill the existing server if a new is not good. Unfortunately, a forked process does not have an access to electron APIs, it is plain node process with some flags. My mental map looks like that: There is a possible solution to the issue to spawn a new electron process for each server worker instead of using the cluster module but it will involve reimplementation of things already done by the cluster module. For now if you are not interested in the dynamic extensions you can indeed use
If you can share what you are trying to achieve specifically we could come up with more specific suggestions :) |
Thanks for the explanation. In this specific case, we need to know where electron is being executed from so that we can run other installed binaries installed with our application. I can see the need to access the other electron app methods, too. Perhaps this object needs to be exposed to the worker processes? |
Ironically it seems electron app methods are available in frontend modules via electron.remote.app, however it seems non-sensical to pull data through to the frontend only to send it back to the backend! |
@thegecko does __dirname or __filename not let you find out where your extension is installed? |
Probably, but we got round this somehow years ago ;) |
We have a need to access the execution path of Theia when running in electron using the following method:
The expectation is that the electron environment is available to an electron backend as mentioned in the extension README.
This works as expected in a debug scenario, however fails to work when running the application standalone.
Investigation has shown this is due to the use of the Node.js cluster module which is disabled when debugging.
Short of disabling clustering in the target application, is there a recommended way of achieving electron environment access? I was expecting to see something using IPC, but can't see any example of this in the codebase.
Thanks!
The text was updated successfully, but these errors were encountered: