In an electron application, I spawn a shell process proc to which the application
then talks via pipes, i.e. proc.stdin.write("cmd_to_shell_proc") and
proc.stdout.on("data", (data) => {//do sth with response}).
The data contains particular tokens from which it is clear what command had
been sent to the process. For most responses it is enough to know to which
command they reply, but there is one command I send from
two different components in my UI for which I would like to handle the
responses differently, depending on the UI component that sent it. I currently process the responses on the basis
of the string token contained in the data sent back from the process,
and I have not found a way to propagate any information about the originally calling process into the data handling in proc.stdout.on("data", ...) .
Is there any way to attribute the data being returned from the shell process to
the original caller of proc.stdin.write("<some command>")?
Any suggestions or advice would be highly appreciated!