<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading;

namespace Leeroy
{
	static class Program
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		static void Main(string[] args)
		{
			if (args.FirstOrDefault() == "/test")
			{
				Overseer overseer = new Overseer(new CancellationTokenSource().Token, "BradleyGrainger", "Configuration", "master");
				overseer.Run(null);
			}
			else
			{
				ServiceBase.Run(new ServiceBase[] { new Service() });
			}
		}
	}
}
<commit_msg>Allow Leeroy to run until canceled in test mode.<commit_after>﻿using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.ServiceProcess;
using System.Threading;
using System.Threading.Tasks;

namespace Leeroy
{
	static class Program
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		static void Main(string[] args)
		{
			if (args.FirstOrDefault() == "/test")
			{
				var tokenSource = new CancellationTokenSource();
				Overseer overseer = new Overseer(tokenSource.Token, "BradleyGrainger", "Configuration", "master");
				var task = Task.Factory.StartNew(overseer.Run, tokenSource, TaskCreationOptions.LongRunning);

				MessageBox(IntPtr.Zero, "Leeroy is running. Click OK to stop.", "Leeroy", 0);

				tokenSource.Cancel();
				try
				{
					task.Wait();
				}
				catch (AggregateException)
				{
					// TODO: verify this contains a single OperationCanceledException
				}

				// shut down
				task.Dispose();
				tokenSource.Dispose();
			}
			else
			{
				ServiceBase.Run(new ServiceBase[] { new Service() });
			}
		}

		[DllImport("user32.dll", CharSet = CharSet.Auto)]
		public static extern int MessageBox(IntPtr hWnd, String text, String caption, int options);
	}
}

{'fraction_non_alphanumeric': 0.12708669897684438, 'fraction_numerical': 0.0016155088852988692, 'mean_word_length': 3.4879227053140096, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6500640', 'n_tokens_mistral': 684, 'n_tokens_neox': 581, 'n_words': 150}