File path in system/child_process spawn

Hello,

After stopping using of binary XPCOM components in FF40 I had to migrate urgently to this new technology system/child_process and encountered lack of documentation and working examples. So would be great if someone advise me a proper method to start my messaging host .exe

var child_process = require("sdk/system/child_process");  
var message_host = child_process.spawn('C:\\addons\\messaging\\myMessagingHost.exe'); 

The problem is the above code works only when the fully qualified path is used otherwise the error “NS_ERROR_FILE_UNRECOGNIZED_PATH” is returned. Even if I put myMessagingHost.exe to the windows system directory it cannot be found.

The file myMessagingHost.exe will be installed separately from the extension in user-defined location along with the main application. How can the extension find out that path? Ideally would be using Windows Registry but AFAIK the Add-Ons SDK cannot read the Registry. What is the recommended way?

I looked into child_process, and it looks like the way you’re writing the path is correct. My guess is Firefox doesn’t have access over the paths you’ve tried. Perhaps you should try with a path in the profile directory, to make sure. You could also try using the nsIProcess component instead, and see whether those paths work there or not.