<commit_before>// var os          = require('os')
var SlackBot    = require('slackbots')

var c = require('./c.js')

var slackbot_settings = {
    token: '<KEY>',
    // name: 'noise'
}
var slackbot = new SlackBot(slackbot_settings)


function restart() {
    var datestring = new Date().toISOString().replace(/T/, ' ').replace(/:/g, '-').replace(/\..+/, '')
    slackbot.postMessageToChannel('test', datestring + ':*' + c.__SCREEN_ID + '*: :sunrise: down. then up again', {as_user: true})
    console.log('=====================================')
    console.log('== RELAUNCHING! =====================')
    console.log('=====================================')

    var child_process = require('child_process')

    if (process.platform === 'darwin') {
        child_process.exec('nwjs .', function (err, stdout, stderr) {
            if (err !== null) { throw err }
            console.log('stdout: ' + stdout)
            console.log('stderr: ' + stderr)
        })
        setTimeout(function () {
            process.exit(0)
        }, 1500)
    } else {
        var child = child_process.spawn(process.execPath, ['./', c.__SCREEN_ID], {detached: true})
        child.unref()

        setTimeout(function () {
            process.exit(0)
        }, 1500)
    }
}


function upgrade() {
    var datestring = new Date().toISOString().replace(/T/, ' ').replace(/:/g, '-').replace(/\..+/, '')
    slackbot.postMessageToChannel('test', datestring + ':*' + c.__SCREEN_ID + '*: :arrow_double_up: to latest release', {as_user: true})
    console.log('== UPGRADING! =======================')

    var child_process = require('child_process')

    if (process.platform === 'darwin') {
        child_process.exec('. launcher.sh', function (err, stdout, stderr) {
            if (err !== null) { throw err }
            console.log('stdout: ' + stdout)
            console.log('stderr: ' + stderr)
        })
        setTimeout(function () { process.exit(0) }, 1500)
    } else if (process.platform === 'linux') {
        child_process.exec('. launcher.sh', function (err, stdout, stderr) {
            if (err !== null) { throw err }
            console.log('stdout: ' + stdout)
            console.log('stderr: ' + stderr)
        })
        setTimeout(function () { process.exit(0) }, 1500)
    } else if (process.platform === 'win32') {
        child_process.exec('cmd /c launcher.bat', function (err, stdout, stderr) {
            if (err !== null) { throw err }
            console.log('stdout: ' + stdout)
            console.log('stderr: ' + stderr)
        })
        setTimeout(function () {
            process.exit(0)
        }, 1500)
    } else {
        slackbot.postMessageToChannel('test', datestring + ':*' + c.__SCREEN_ID + '*: :exclamation: Player doesnot now, what to do with ' + process.platform, {as_user: true})
    }
}

function latest() {
    var datestring = new Date().toISOString().replace(/T/, ' ').replace(/:/g, '-').replace(/\..+/, '')
    slackbot.postMessageToChannel('test', datestring + ':*' + c.__SCREEN_ID + '*: :warning: installing latest build', {as_user: true})
    console.log('== UPGRADING! =======================')

    var child_process = require('child_process')

    if (process.platform === 'darwin') {
        child_process.exec('. latest.sh', function (err, stdout, stderr) {
            if (err !== null) { throw err }
            console.log('stdout: ' + stdout)
            console.log('stderr: ' + stderr)
        })
        setTimeout(function () {
            process.exit(0)
        }, 1500)
    } else if (process.platform === 'linux') {
        child_process.exec('. latest.sh', function (err, stdout, stderr) {
            if (err !== null) { throw err }
            console.log('stdout: ' + stdout)
            console.log('stderr: ' + stderr)
        })
        setTimeout(function () {
            process.exit(0)
        }, 1500)
    } else if (process.platform === 'win32') {
        console.log('== win32: running latest.bat')
        child_process.execFile('latest.bat', function (err, stdout, stderr) {
            setTimeout(function () {
                process.exit(0)
            }, 1000)
            console.log('== win32: returned from latest.bat')
            if (err !== null) {
                console.log('== win32: latest.bat errored out')
                slackbot.postMessageToChannel('test', datestring + ':*' + c.__SCREEN_ID + '*: :exclamation: ' + err, {as_user: true})
                slackbot.postMessageToChannel('test', datestring + ':*' + c.__SCREEN_ID + '*: :exclamation: ' + stdout, {as_user: true})
                slackbot.postMessageToChannel('test', datestring + ':*' + c.__SCREEN_ID + '*: :exclamation: ' + stderr, {as_user: true})
                throw err
            }
            console.log('== win32: latest.bat succeeded')
            slackbot.postMessageToChannel('test', datestring + ':*' + c.__SCREEN_ID + '*: :exclamation: updated to latest build.', {as_user: true})
        })<commit_msg>win32<commit_after>// var os          = require('os')
var SlackBot    = require('slackbots')

var c = require('./c.js')

var slackbot_settings = {
    token: '<KEY>',
    // name: 'noise'
}
var slackbot = new SlackBot(slackbot_settings)


function restart() {
    var datestring = new Date().toISOString().replace(/T/, ' ').replace(/:/g, '-').replace(/\..+/, '')
    slackbot.postMessageToChannel('test', datestring + ':*' + c.__SCREEN_ID + '*: :sunrise: down. then up again', {as_user: true})
    console.log('=====================================')
    console.log('== RELAUNCHING! =====================')
    console.log('=====================================')

    var child_process = require('child_process')

    if (process.platform === 'darwin') {
        child_process.exec('nwjs .', function (err, stdout, stderr) {
            if (err !== null) { throw err }
            console.log('stdout: ' + stdout)
            console.log('stderr: ' + stderr)
        })
        setTimeout(function () {
            process.exit(0)
        }, 1500)
    } else {
        var child = child_process.spawn(process.execPath, ['./', c.__SCREEN_ID], {detached: true})
        child.unref()

        setTimeout(function () {
            process.exit(0)
        }, 1500)
    }
}


function upgrade() {
    var datestring = new Date().toISOString().replace(/T/, ' ').replace(/:/g, '-').replace(/\..+/, '')
    slackbot.postMessageToChannel('test', datestring + ':*' + c.__SCREEN_ID + '*: :arrow_double_up: to latest release', {as_user: true})
    console.log('== UPGRADING! =======================')

    var child_process = require('child_process')

    if (process.platform === 'darwin') {
        child_process.exec('. launcher.sh', function (err, stdout, stderr) {
            if (err !== null) { throw err }
            console.log('stdout: ' + stdout)
            console.log('stderr: ' + stderr)
        })
        setTimeout(function () { process.exit(0) }, 1500)
    } else if (process.platform === 'linux') {
        child_process.exec('. launcher.sh', function (err, stdout, stderr) {
            if (err !== null) { throw err }
            console.log('stdout: ' + stdout)
            console.log('stderr: ' + stderr)
        })
        setTimeout(function () { process.exit(0) }, 1500)
    } else if (process.platform === 'win32') {
        child_process.exec('cmd /c launcher.bat', function (err, stdout, stderr) {
            if (err !== null) { throw err }
            console.log('stdout: ' + stdout)
            console.log('stderr: ' + stderr)
        })
        setTimeout(function () {
            process.exit(0)
        }, 1500)
    } else {
        slackbot.postMessageToChannel('test', datestring + ':*' + c.__SCREEN_ID + '*: :exclamation: Player doesnot now, what to do with ' + process.platform, {as_user: true})
    }
}

function latest() {
    var datestring = new Date().toISOString().replace(/T/, ' ').replace(/:/g, '-').replace(/\..+/, '')
    slackbot.postMessageToChannel('test', datestring + ':*' + c.__SCREEN_ID + '*: :warning: installing latest build', {as_user: true})
    console.log('== UPGRADING! =======================')

    var child_process = require('child_process')

    if (process.platform === 'darwin') {
        child_process.exec('. latest.sh', function (err, stdout, stderr) {
            if (err !== null) { throw err }
            console.log('stdout: ' + stdout)
            console.log('stderr: ' + stderr)
        })
        setTimeout(function () {
            process.exit(0)
        }, 1500)
    } else if (process.platform === 'linux') {
        child_process.exec('. latest.sh', function (err, stdout, stderr) {
            if (err !== null) { throw err }
            console.log('stdout: ' + stdout)
            console.log('stderr: ' + stderr)
        })
        setTimeout(function () {
            process.exit(0)
        }, 1500)
    } else if (process.platform === 'win32') {
        console.log('== win32: running latest.bat')
        child_process.execFile('latest.bat')
        slackbot.on('message', function(message) {
            if ((message.text.indexOf(':*' + c.__SCREEN_ID + '*: :up:') > -1) {
                console.log('New instance started. shutting down.')
                process.exit(0)
            }
        }
{'fraction_non_alphanumeric': 0.20140161725067385, 'fraction_numerical': 0.01045822102425876, 'mean_word_length': 2.405286343612335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '5957618', 'n_tokens_mistral': 2921, 'n_tokens_neox': 2814, 'n_words': 576}