<commit_before>var commands = require('./lib/commands.js'),
	fs = require('fs'),
	spawn = require('child_process').spawn,
	ipc = require('ipc'),
	AppDirectory = require('appdirectory')

var i = process.argv.indexOf('--electron-update')
if (i > 0) {
	var app = require('app'),
		BrowserWindow = require('browser-window')

	var args = JSON.parse(process.argv[i + 1])
	// {
	//	name: appName,
	// 	cwd: process.cwd(),
	// 	argv: process.argv
	// }

	app.on('ready', function () {

		var win = new BrowserWindow({ 
			width: 400,
			height: 100,
			frame: false
		})		
        win.loadUrl('file://' + __dirname + '/update.html')
        ipc.on('initialize', function (event, arg) {
        	event.sender.send('initialize', args)
        })

		commands.update(process.cwd(), function (err) {
			if(err) return console.log('' + util.inspect(err))			
			console.log('updated!')
			var dirs = new AppDirectory(args.appName)
			var appDir = path.dirname(dirs.userData())
			var updateFile = path.join(appDir, '.update')
			fs.unlink(updateFile, function () {
				var execPath = args.argv.shift()
				var child = spawn(execPath, args.argv, {
					detached: true,
					cwd: args.cwd,
					stdio: [ 'ignore', 'pipe', 'pipe'] // out, err]<commit_msg>minor change to index<commit_after>var commands = require('./lib/commands.js'),
	util = require('util'),
	fs = require('fs'),
	spawn = require('child_process').spawn,
	ipc = require('ipc'),
	AppDirectory = require('appdirectory')

var i = process.argv.indexOf('--electron-update')
if (i > 0) {
	var app = require('app'),
		BrowserWindow = require('browser-window')

	var args = JSON.parse(process.argv[i + 1])
	// {
	//	name: appName,
	// 	cwd: process.cwd(),
	// 	argv: process.argv
	// }

	app.on('ready', function () {

		var win = new BrowserWindow({ 
			width: 400,
			height: 100,
			frame: false
		})
    win.loadUrl('file://' + __dirname + '/update.html')
    ipc.on('initialize', function (event, arg) {
    	event.sender.send('initialize', args)
    })

    var _log = console.log
    console.log = function (line) {
    	_log(line)
    	fs.appendFile('update.log', line + '\n')
    }

		commands.update(process.cwd(), function (err) {
			if(err) return console.log(err)
			var dirs = new AppDirectory(args.appName)
			var appDir = path.dirname(dirs.userData())
			var updateFile = path.join(appDir, '.update')
			fs.unlink(updateFile, function () {
				var execPath = args.argv.shift()
				var child = spawn(execPath, args.argv, {
					detached: true,
					cwd: args.cwd,
					stdio: [ 'ignore', 'pipe', 'pipe'] // out, err]
{'fraction_non_alphanumeric': 0.18001555209953343, 'fraction_numerical': 0.006220839813374806, 'mean_word_length': 3.1905537459283386, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6728428', 'n_tokens_mistral': 1002, 'n_tokens_neox': 888, 'n_words': 194}