別のコンソール アプリケーションを呼び出せるように、新しいプロセスを fork() しようとしています。
フォークは正常に行われ、新しいプロセス ID を取得しますが、プロセスはスリープ状態にあり、ブラウザーが終了してもまったくアクティブになりません。
サンプル プラグイン プロジェクトを使用し、echo メソッドを変更して fork を実行しました。
通常のコンソール アプリケーションは、フォーク コードで正常に動作します。
firebreath プラグイン アプリで考慮しなければならないことはありますか?
誰かが問題の可能性を提案できますか?
プラットフォームは archlinux 64 ビットです。
FB::variant PluginTestVZAPI::echo(const FB::variant& msg)
{
static int n(0);
fire_echo("So far, you clicked this many times: ", n++);
// fork
pid_t pid = fork();
if(pid == 0) // Child
{
m_host->htmlLog("child process");
}
else if (pid < 0) // Failed to fork
{
m_host->htmlLog("Failed to fork");
m_host->htmlLog(boost::lexical_cast<std::string>(pid));
}
else // Parent
{
m_host->htmlLog("Parent process");
}
m_host->htmlLog("Child Process PID = " + boost::lexical_cast<std::string>(pid));
// end fork
// return "foobar";
return msg;
}