Native Message - close process when close exe


(Drwal Michal) #1

Hi

I have problem with web extension for firefox. I develop web extension with native messaging. Add-ons open my exe ( chromext.exe ) file and from

exe (chromext.exe) open file by process.start(pathtofile). Unfortunatly when i close exe (chromext.exe) , file is close too. Where is a problem.

For chrome extension all is correct.
Application is .NET C#.

WebExte -> chromext.exe-> Process.Start(pathfile) (open file)
If kill chromext.exe ( close App ) , opened file is closing.

Where is a problem. Why file is close when
My manifest_app.json

{
“name”: “com.zeto.eldok”,
“description”: “test”,
“path”: “chromext.exe”,
“type”: “stdio”,
“allowed_extensions”: [ “fa4f9f836de80e6a94efdefc24cdd3b277ce09d9@temporary-addon” ]
}


(Martin Giger) #2

You have to ensure the application you launch is not launched as child to the current process but is launched as its own thing. Not sure how that’d work in your case (I don’t know C# nor .NET).


(Drwal Michal) #3

This is standard lunched. It is not lunched as a child. On Chrome works correctly ( the same application and file) but firefox works wrong. Maybe i should set any configuration to ma nifast.json file?


(Niklas Gollenstede) #4

Maybe Firefox explicitly terminates child processes as well, and chrome doesn’t.

If that is the case, you need to make sure that the spawned process is not a child of your chromext.exe.
You can check it with Process Hacker and/or Explorer.

This answer tells you how to spawn a process like that in C#:

System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
psi.FileName = @"cmd";
psi.Arguments = "/C start notepad.exe";
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
System.Diagnostics.Process.Start(psi);

I don’t know C# very well, but that looks like it should work.


(Drwal Michal) #5

You have right. It is lunched as child process for firefox. I check it with Process Hacker. I resolved the problem. Thanks.