<commit_before>
import spawn from '../spawn'
import sf from '../sf'

import common from './common'

import tmp from 'tmp'

// note: itch-player's password is not a secret, as everything itch-player
// owns should be accessible by other users as well (but not the other
// way around)
const USER = 'itch-player'
const PASSWORD = '<PASSWORD>'

export async function check () {
  const errors = []
  const needs = []

  const userCheck = await spawn.exec({command: 'elevate.exe', args: ['--runas', USER, PASSWORD, 'echo', 'good']})
  if (userCheck.code !== 0) {
    needs.push({
      type: 'user',
      err: userCheck.err,
      code: userCheck.code
    })
  }

  return {errors, needs}
}

export async function install (opts, needs) {
  return await common.tendToNeeds(opts, needs, {
    user: async () => {
      const lines = []
      // in case the user was incorrectly setup
      lines.push(`net user ${USER} ${PASSWORD} /add`)<commit_msg>having echo.cmd would be just too easy wouldn't it, whoever came up with batch/win32 userland years ago, hmm?<commit_after>
import spawn from '../spawn'
import sf from '../sf'

import common from './common'

import tmp from 'tmp'

// note: itch-player's password is not a secret, as everything itch-player
// owns should be accessible by other users as well (but not the other
// way around)
const USER = 'itch-player'
const PASSWORD = '<PASSWORD>'

export async function check () {
  const errors = []
  const needs = []

  const userCheck = await spawn.exec({command: 'elevate.exe', args: ['--runas', USER, PASSWORD, 'cmd.exe', '/c', 'echo', 'good']})
  if (userCheck.code !== 0) {
    needs.push({
      type: 'user',
      err: userCheck.err,
      code: userCheck.code
    })
  }

  return {errors, needs}
}

export async function install (opts, needs) {
  return await common.tendToNeeds(opts, needs, {
    user: async () => {
      const lines = []
      // in case the user was incorrectly setup
      lines.push(`net user ${USER} ${PASSWORD} /add`)
{'fraction_non_alphanumeric': 0.1409295352323838, 'fraction_numerical': 0.001999000499750125, 'mean_word_length': 3.1535269709543567, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '490740', 'n_tokens_mistral': 637, 'n_tokens_neox': 617, 'n_words': 230}