<commit_before>﻿using System;
using System.Collections.Generic;
using System.Threading;
using Nancy;
using Nancy.Hosting.Self;

namespace ChildProcessUtil
{
    public class Program
    {
        private const string HttpAddress = "http://localhost:";
        private static NancyHost host;
        private static void Main(string[] args)
        {
            StartServer(30197, int.Parse(args[0]));
        }

        public static void StartServer(int port, int mainProcessId)
        {
            var hostConfigs = new HostConfiguration
            {
                UrlReservations = new UrlReservations {CreateAutomatically = true}
            };

            var uriString = HttpAddress + port;
            ProcessModule.ActiveProcesses = new List<int>();
            host = new NancyHost(new Uri(uriString), new DefaultNancyBootstrapper(), hostConfigs);
            host.Start();
            new MainProcessWatcher(mainProcessId);
            Thread.Sleep(Timeout.Infinite);
        }

        internal static void StopServer(int port)
        {
            host.Stop();
        }
    }
}<commit_msg>Take listening port as port parameter along main process id<commit_after>﻿using System;
using System.Collections.Generic;
using System.Threading;
using Nancy;
using Nancy.Hosting.Self;

namespace ChildProcessUtil
{
    public class Program
    {
        private const string HttpAddress = "http://localhost:";
        private static NancyHost host;
        private static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                Console.WriteLine("usage: ChildProcessUtil.exe serverPort mainProcessId");
                return;
            }
            StartServer(int.Parse(args[0]), int.Parse(args[1]));
        }

        public static void StartServer(int port, int mainProcessId)
        {
            var hostConfigs = new HostConfiguration
            {
                UrlReservations = new UrlReservations {CreateAutomatically = true}
            };

            var uriString = HttpAddress + port;
            ProcessModule.ActiveProcesses = new List<int>();
            host = new NancyHost(new Uri(uriString), new DefaultNancyBootstrapper(), hostConfigs);
            host.Start();
            new MainProcessWatcher(mainProcessId);
            Thread.Sleep(Timeout.Infinite);
        }

        internal static void StopServer(int port)
        {
            host.Stop();
        }
    }
}
{'fraction_non_alphanumeric': 0.08598207008964955, 'fraction_numerical': 0.003667481662591687, 'mean_word_length': 2.0572851805728516, 'pattern_counts': {'":': 0, '<': 5, '<?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': '488068', 'n_tokens_mistral': 627, 'n_tokens_neox': 606, 'n_words': 159}