<commit_before>const os = require('os');
const path = require('path');
const child_process = require('child_process');
const utils = require('../utils.js');
const KiteError = require('../kite-error');
const {STATES} = require('../constants');

const OSXSupport = {
  RELEASE_URL: 'https://alpha.kite.com/release/dls/mac/current',
  APPS_PATH: '/Applications/',
  KITE_DMG_PATH: '/tmp/Kite.dmg',
  KITE_VOLUME_PATH: '/Volumes/Kite/',
  KITE_APP_PATH: {mounted: '/Volumes/Kite/Kite.app'},
  KITE_SIDEBAR_PATH: '/Applications/Kite.app/Contents/MacOS/KiteSidebar.app',
  KITE_BUNDLE_ID: 'com.kite.Kite',
  SESSION_FILE_PATH: path.join(os.homedir(), '.kite', 'session.json'),

  get releaseURL() {
    return this.RELEASE_URL;
  },

  get downloadPath() {
    return this.KITE_DMG_PATH;
  },

  get installPath() {
    return this.allInstallPath[0];
  },

  get allInstallPath() {
    return String(child_process.execSync('mdfind kMDItemCFBundleIdentifier = "com.kite.Kite"')).trim().split('\n');
  },

  get enterpriseInstallPath() {
    return this.allEnterpriseInstallPath[0];
  },

  get allEnterpriseInstallPath() {
    return String(child_process.execSync('mdfind kMDItemCFBundleIdentifier = "enterprise.kite.Kite"')).trim().split('\n');
  },

  get sessionFilePath() {
    return this.SESSION_FILE_PATH;
  },

  isAdmin() {
    try {
      const user = String(child_process.execSync('whoami')).trim();
      const adminUsers = String(child_process.execSync('dscacheutil -q group -a name admin'))
      .split('\n')
      .filter(l => /^users:/.test(l))[0]
      .trim()
      .replace(/users:\s+/, '')
      .split(/\s/g);
      return adminUsers.includes(user);
    } catch (e) {
      return false;
    }
  },

  arch() {
    return os.arch();
  },
<commit_msg>Use spawnSync instead of execSync for retrieving Kite install paths<commit_after>const os = require('os');
const path = require('path');
const child_process = require('child_process');
const utils = require('../utils.js');
const KiteError = require('../kite-error');
const {STATES} = require('../constants');

const OSXSupport = {
  RELEASE_URL: 'https://alpha.kite.com/release/dls/mac/current',
  APPS_PATH: '/Applications/',
  KITE_DMG_PATH: '/tmp/Kite.dmg',
  KITE_VOLUME_PATH: '/Volumes/Kite/',
  KITE_APP_PATH: {mounted: '/Volumes/Kite/Kite.app'},
  KITE_SIDEBAR_PATH: '/Applications/Kite.app/Contents/MacOS/KiteSidebar.app',
  KITE_BUNDLE_ID: 'com.kite.Kite',
  SESSION_FILE_PATH: path.join(os.homedir(), '.kite', 'session.json'),

  get releaseURL() {
    return this.RELEASE_URL;
  },

  get downloadPath() {
    return this.KITE_DMG_PATH;
  },

  get installPath() {
    return this.allInstallPath[0];
  },

  get allInstallPath() {
    return String(child_process.spawnSync('mdfind', [
      'kMDItemCFBundleIdentifier = "com.kite.Kite"',
    ]).stdout).trim().split('\n');
  },

  get enterpriseInstallPath() {
    return this.allEnterpriseInstallPath[0];
  },

  get allEnterpriseInstallPath() {
    return String(child_process.spawnSync('mdfind', [
      'kMDItemCFBundleIdentifier = "enterprise.kite.Kite"',
    ]).stdout).trim().split('\n');
  },

  get sessionFilePath() {
    return this.SESSION_FILE_PATH;
  },

  isAdmin() {
    try {
      const user = String(child_process.execSync('whoami')).trim();
      const adminUsers = String(child_process.execSync('dscacheutil -q group -a name admin'))
      .split('\n')
      .filter(l => /^users:/.test(l))[0]
      .trim()
      .replace(/users:\s+/, '')
      .split(/\s/g);
      return adminUsers.includes(user);
    } catch (e) {
      return false;
    }
  },

  arch() {
    return os.arch();
  },

{'fraction_non_alphanumeric': 0.17546754675467546, 'fraction_numerical': 0.0016501650165016502, 'mean_word_length': 3.592171717171717, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4467913', 'n_tokens_mistral': 1302, 'n_tokens_neox': 1286, 'n_words': 209}