瀏覽單個文章
dkjfso
Senior Member
 

加入日期: Apr 2005
文章: 1,207
引用:
作者dkjfso
問一個非一般使用的問題

Firefox使用WebExtension架構寫外掛的時候
可以在HKEY_CURRENT_USER\SOFTWARE\Mozilla\NativeMessagingHosts\<name>
記上本地.exe檔案位置以後
在WebExtension裡去呼叫執行該exe
並使用stdio傳輸資料
讓它去做一些用其它語言開發出來的功能

我的情況是我要在WebExtension執行a.exe
然後a.exe幫我叫出b.exe並傳送某些網頁資料給b.exe去執行某些任務

遇到的問題是
當Firefox關閉時
它會去主動關閉掉a.exe和b.exe(如果用工作管理員結束firefox.exe,a.exe和b.exe則不會被結束)
但我的b.exe本來就是可以獨立運作的軟體
並不希望隨著firefox的關閉一起停止運行
若我是先手動打開b.exe
而不是透過a.exe去啟動
則b.exe不會被關閉

雖然這對firefox來說算是合理的設計
因為針對瀏覽器所實現的功能
理當隨著瀏覽器的結束一起被資源回收
但我的b.exe並不是專...

https://developer.mozilla.org/en-US...ative_messaging

On Windows, the browser puts the native application's process into a Job object, and kills the job. If the native application launches any additional processes and wants them to remain open after the native application itself is killed, then the native application must launch the additional process with the CREATE_BREAKAWAY_FROM_JOB flag.

哇咧
找到答案了
舊 2017-04-14, 04:20 PM #450
回應時引用此文章
dkjfso離線中