Prompted by "Google Chrome didn't shut down correctly.... "

4.3k views Asked by At

Using Google Chrome 38.0.2125.111 m in a Windows 7 environment. It is launched by a batch file & set to go to a specific (internal) URL. The Windows environment is going to be locked down, permitting only a handful of options available to the user.

Chrome is being used because IE will be accessing a different site. Without going into boring detail, using both sites on a single browser allowed a user to access an account that wasn't theirs. Both browsers will be launched using one of two batch files. The Chrome batch file supplies the username & password to bypass a login screen on that application.

To keep from opening multiple windows in Chrome, the following batch file is used:

taskkill /f /t /im chrome.exe > NUL
ping -n 3 127.0.0.1 > NUL
START /max chrome "http://myinternalwebsite?uid=x&pwd=y"

Taskkill is used to close chrome (/f = force /t = terminates process & any child ones /im = image name).

If the Chrome session is closed (using the X at the upper right corner of the screen), the batch file works fine. However, if there is already a chrome instance running, we get the yellow bar with the frowning folder & a message saying:

Google Chrome didn't shut down correctly. To reopen the pages you had open, click Restore.

I have tried several command line options when launching Google Chrome, but none will keep the message from displaying. Ones I have tried are:

  • --disable-restore-session-state
  • --disable-session-crashed-bubble
  • --incognito

among others. I've experimented with some of the settings in Chrome, but none have (yet) worked. The --incognito option works - sort of. It keeps blocking plugins, one of which is Silverlight - one of the chief components for the website to function. Even though it does get rid of the message, it leaves the site not functioning properly.

The intent on using Taskkill to flush any existing Chrome sessions was to prevent the user opening up a dozen different Chrome instances of the same thing.

Is there any way to keep a user from opening multiple instances of Chrome that won't leave Chrome thinking it didn't close properly? Given the user restrictions, I'm not sure that a script/batch file to edit the Preferences file in the Chrome folder will work. An extension may be an option, but a third party application will not be.

Would appreciate any thoughts or assistance.

Thanks!

1

There are 1 answers

0
valentt On

Chromium writes exit status into Preferences file. When it starts it writes Preferences file with: "exited_cleanly": false

and upon clean exit writes Preferences file with: "exited_cleanly": true

To prevent message about unclean shut down make sure that you have "exited_cleanly": true written in your Preferences file

On my Linux kiosk running on Raspberry Pi this sed command line added to /etc/rc.local fixes issue permanently:

sed -i 's/exited_cleanly\":\ false/exited_cleanly\":\ true/g' /home/pi/.config/chromium/Default/Preferences