Native messaging and EPIPE error

119 views
Skip to first unread message

Nafees Nehar

unread,
Sep 4, 2024, 4:22:32 PMSep 4
to Chromium Extensions
I am trying to establish native messaging with my electron app. 
Details of what happens:
  1. port = chrome.runtime.connectNative("com.me.test");
    port.postMessage({
                text: "Hello from Chrome extension!",
              });
  2. The electron app is launched which handles which reads the stream and I can see that correct message is received.
    process.stdin.on("data"... is used
  3. An acknowledgement is sent back using
    process.stdout.write...
  4. The response is received in the extension
  5. But the electron app closes abruptly now
  6. And port.onDisconnect event is fired with runtime.lastError as "Error when communicating with the native messaging host."
  7. process.stdout.on("error".... gets "Error: write EPIPE"
  8. Then stdout - close event is fired
  9. The closing of the app is so quick that I had to log details to a file to check the received stdin messages 
Need help why this is the behaviour with this particular app while the same stdio handling works smoothly in another app.

Thanks

Patrick Kettner

unread,
Sep 4, 2024, 10:36:14 PMSep 4
to Nafees Nehar, Chromium Extensions
Hi Nafees!

EPIPE is a standard POSIX error that generally means you are attempting to write to a connection that is closed. Since it is happening around the time the electron app closes, that sounds more or less expected. I would look into your electron app's logs to see why it is crashing. If you don't have any logs, perhaps you could launch a debugger with the process and step through it to see if you can catch the error?

patrick

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/57ae713f-25ba-4abd-9aaa-9d1e81b1b64cn%40chromium.org.
Reply all
Reply to author
Forward
0 new messages