<commit_before>// This file is quite hacky, silly and overall quite dumb...
// But it needs to be here to handle the upgrade process from the old GPMDP
import { exec } from 'child_process';

if (process.platform === 'win32' && !Settings.get('checkedForOldVersion', false)) {
  exec('wmic product where Vendor="MarshallOfSound" get PackageCache /format:value', (err, out) => {
    Settings.set('checkedForOldVersion', true);
    const MSIPath = out.replace(/(?:\r\n|\r|\n)/g, '').replace('PackageCache=', '');
    if (MSIPath.split('.msi').length > 1) {
      Emitter.once('uninstall:confirm', () => {
        exec(`msiexec /uninstall ${MSIPath}`);
      });
      Emitter.sendToWindowsOfName('main', 'uninstall:request');
    }
  });
}<commit_msg>try {} catch {} the old_win32 check to ensure that syncronous errors are caught<commit_after>// This file is quite hacky, silly and overall quite dumb...
// But it needs to be here to handle the upgrade process from the old GPMDP
import { exec } from 'child_process';

if (process.platform === 'win32' && !Settings.get('checkedForOldVersion', false)) {
  try {
    exec('wmic product where Vendor="MarshallOfSound" get PackageCache /format:value', (err, out) => {
      if (err) return;
      Settings.set('checkedForOldVersion', true);
      const MSIPath = out.replace(/(?:\r\n|\r|\n)/g, '').replace('PackageCache=', '');
      if (MSIPath.split('.msi').length > 1) {
        Emitter.once('uninstall:confirm', () => {
          exec(`msiexec /uninstall ${MSIPath}`);
        });
        Emitter.sendToWindowsOfName('main', 'uninstall:request');
      }
    });
  } catch (err) {
    Logger.error('Failed to check for old version', err);
  }
}
{'fraction_non_alphanumeric': 0.17031342400946187, 'fraction_numerical': 0.004730928444707274, 'mean_word_length': 3.622950819672131, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6153363', 'n_tokens_mistral': 536, 'n_tokens_neox': 529, 'n_words': 142}