Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次のようなPHPスクリプトがあります。
<?php system("firefox http://run.imacros.net/?m=the_macro.iim 2>&1"); // CODE// ?>
ターミナルからこれを実行すると、FireFox が正常に開きますが、スクリプト内の残りのコードは決して実行されません! FireFox を手動で閉じると、スクリプトは残りのコードを実行します。
system() コマンドでスタックせずにスクリプトを実行したい。
stderrをstdoutに2>&1リダイレクトしますが、 stdoutをリダイレクトしていないため、いずれかのハンドルに出力が生成された場合、PHP は待機します。両方のハンドルへの出力を破棄するには、次を使用します。
2>&1
system("firefox http://run.imacros.net/?m=the_macro.iim >/dev/null 2>&1");