<commit_before>﻿using System;
using System.Diagnostics;
using Cake.Core;

namespace Cake.Common
{
    /// <summary>
    /// Contains functionality related to processes.
    /// </summary>
    public static class ProcessExtensions
    {
        /// <summary>
        /// Starts the process resource that is specified by the filename.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="fileName">The file name.</param>
        /// <returns>The exit code that the started process specified when it terminated.</returns>
        public static int StartProcess(this ICakeContext context, string fileName)
        {
            return StartProcess(context, fileName, new ProcessSettings());
        }

        /// <summary>
        /// Starts the process resource that is specified by the filename and settings.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="settings">The settings.</param>
        /// <returns>The exit code that the started process specified when it terminated.</returns>
        public static int StartProcess(this ICakeContext context, string fileName, ProcessSettings settings)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (fileName == null)
            {
                throw new ArgumentNullException("fileName");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            // Get the working directory.
            var workingDirectory = settings.WorkingDirectory ?? context.Environment.WorkingDirectory;
            workingDirectory = workingDirectory.MakeAbsolute(context.Environment);   

            // Get the process start info.
            var info = new ProcessStartInfo();
            info.FileName = fileName;
            info.WorkingDirectory = workingDirectory.FullPath;
            info.Arguments = settings.Arguments ?? string.Empty;

            // Start the process.
            var process = context.ProcessRunner.Start(info);
            if (process == null)
            {
                throw new CakeException("Could not start process.");
            }

            // Wait for the process to stop.
            process.WaitForExit();

            // Return the exit code.
            return process.GetExitCode();
        }
    }
}
<commit_msg>Added missing attributes.<commit_after>﻿using System;
using System.Diagnostics;
using Cake.Core;
using Cake.Core.Annotations;

namespace Cake.Common
{
    /// <summary>
    /// Contains functionality related to processes.
    /// </summary>
    [CakeAliasCategory("Process")]
    public static class ProcessExtensions
    {
        /// <summary>
        /// Starts the process resource that is specified by the filename.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="fileName">The file name.</param>
        /// <returns>The exit code that the started process specified when it terminated.</returns>
        [CakeMethodAlias]
        public static int StartProcess(this ICakeContext context, string fileName)
        {
            return StartProcess(context, fileName, new ProcessSettings());
        }

        /// <summary>
        /// Starts the process resource that is specified by the filename and settings.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="settings">The settings.</param>
        /// <returns>The exit code that the started process specified when it terminated.</returns>
        [CakeMethodAlias]
        public static int StartProcess(this ICakeContext context, string fileName, ProcessSettings settings)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (fileName == null)
            {
                throw new ArgumentNullException("fileName");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }

            // Get the working directory.
            var workingDirectory = settings.WorkingDirectory ?? context.Environment.WorkingDirectory;
            workingDirectory = workingDirectory.MakeAbsolute(context.Environment);   

            // Get the process start info.
            var info = new ProcessStartInfo();
            info.FileName = fileName;
            info.WorkingDirectory = workingDirectory.FullPath;
            info.Arguments = settings.Arguments ?? string.Empty;

            // Start the process.
            var process = context.ProcessRunner.Start(info);
            if (process == null)
            {
                throw new CakeException("Could not start process.");
            }

            // Wait for the process to stop.
            process.WaitForExit();

            // Return the exit code.
            return process.GetExitCode();
        }
    }
}

{'fraction_non_alphanumeric': 0.10233806055960137, 'fraction_numerical': 0.0, 'mean_word_length': 1.8317959848073793, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, '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': '6421924', 'n_tokens_mistral': 1181, 'n_tokens_neox': 1161, 'n_words': 367}