<commit_before>var sys = require('sys'),
	searchForFile = require('child_process').exec,
	execFindFile = require('child_process').exec,
	fs = require('fs'),
	
	isTimeToExit = false,
	
	processTimeout = 11 * 60 * 1000, // 11 minutes timeout (empirical constant :)) 
	searchInterval = 10000;
	

searchForFile("", getFile);

function getFile(error, stdout, stderr) {
	closeProcessAfter(processTimeout);
	setInterval(tryToGetFile, searchInterval);
};

function closeProcessAfter(timeout) {
	//this will force process closed even if the the file is not found
	setTimeout(function () {isTimeToExit = true;}, timeout); 
}

function tryToGetFile() {
	execFindFile("adb pull /sdcard/android_unit_test_results.xml", checkIfFileExists);
}

function checkIfFileExists(err,stout,stderr) { 

	//if you find file in sdcard exit process
	if(!err) {
		console.log('found file!');
		isTimeToExit = true;
	}
	else {
		console.log(err);
		console.log('file not found yet!');
	}
	
	//if the time to get the file is out exit process
	if(isTimeToExit) {
		process.exit();
	}
}<commit_msg>do not output while waiting for test results file<commit_after>var sys = require('sys'),
	searchForFile = require('child_process').exec,
	execFindFile = require('child_process').exec,
	fs = require('fs'),
	
	isTimeToExit = false,
	
	processTimeout = 11 * 60 * 1000, // 11 minutes timeout (empirical constant :)) 
	searchInterval = 10000;
	
searchForFile("", getFile);

function getFile(error, stdout, stderr) {
	closeProcessAfter(processTimeout);
	setInterval(tryToGetFile, searchInterval);
};

function closeProcessAfter(timeout) {
	//this will force process closed even if the the file is not found
	setTimeout(function () {isTimeToExit = true;}, timeout); 
}

function tryToGetFile() {
	execFindFile("adb pull /sdcard/android_unit_test_results.xml", checkIfFileExists);
}

function checkIfFileExists(err,stout,stderr) { 

	//if you find file in sdcard exit process
	if(!err) {
		console.log('Tests results file found file!');
		isTimeToExit = true;
	}
	else {
		//if the time to get the file is out exit process
    if(isTimeToExit) {
      console.log(err);
      console.log('Tests results file not found!');
      process.exit();
    }
	}
}
{'fraction_non_alphanumeric': 0.12392582541836274, 'fraction_numerical': 0.013568521031207599, 'mean_word_length': 4.686375321336761, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '4931207', 'n_tokens_mistral': 754, 'n_tokens_neox': 697, 'n_words': 192}