0

I wrote a program which creates a child process using fork. In the child process I use execl which opens a local html page using firefox:

execl( "/usr/bin/firefox", "/usr/bin/firefox","/home/xyz/t/webpages/page1.html", (char*)NULL);

In the parent process after sleeping for 5 sec, i send a SIGTERM signal to the child process:

sleep(5);
kill(browser_pid,SIGTERM);

After compiling and executing everything works fine. But when I run the program for more than 5 iterations, firefox starts behaving erratically, and shows up a window to either reset firefox or open in safe mode : enter image description here

when I close the html page manually without sending the SIGTERM signal to the process and use the close button on the browser, it works flawlessly for any number of iterations.

My program is supposed to refresh the webpage every 5 seconds to show new content being written regularly. How can I do the same programatically ?

nagla
  • 87
  • 1
  • 9
  • Use a plugin like **ReloadEvery** or similar. Firefox doesn't like being killed externally. You can also delete the file `sessionstore.js` from the profile folder (every time after you have killed firefox!) to prevent the Safe Mode Popup – Ctx Feb 26 '16 at 19:19
  • thanks... slight variant of your aapproach.... I deleted whole ~/.mozilla and it works. – nagla Feb 27 '16 at 09:40

2 Answers2

0

Try SIGINT instead of SIGTERM.

Andrey Rogov
  • 169
  • 5
0

Deleting the ~/.mozilla folder resolved the issue.

Zulan
  • 21,896
  • 6
  • 49
  • 109
nagla
  • 87
  • 1
  • 9