<commit_before># ----------------------------------------------
# Build script
# ----------------------------------------------

param
(
    [switch] $Release,
    [switch] $ExcludeRazor,
    [switch] $ExcludeDotLiquid,
    [switch] $ExcludeTests,
    [switch] $ExcludeSamples,
    [switch] $Pack,
    [switch] $Run,
    [switch] $OnlyNetStandard
)

$ErrorActionPreference = "Stop"

# ----------------------------------------------
# Helper functions
# ----------------------------------------------

function Invoke-Cmd ($cmd)
{
    Write-Host $cmd -ForegroundColor DarkCyan
    try
    {
        $command = "cmd.exe /C $cmd"
        Invoke-Expression -Command $command
        if ($LastExitCode -ne 0) { Write-Error "An error occured when executing '$cmd'."; return }
    }
    catch
    {
        # Run normal when on Linux
        Invoke-Expression -Command $cmd
    }
}

function Write-DotnetVersion
{
    $dotnetVersion = Invoke-Cmd "dotnet --version"
    Write-Host ".NET Core runtime version: $dotnetVersion" -ForegroundColor Cyan
}

function dotnet-restore ($project, $argv) { Invoke-Cmd "dotnet restore $project $argv" }<commit_msg>Replaced try-catch with environment detection in build.ps1<commit_after># ----------------------------------------------
# Build script
# ----------------------------------------------

param
(
    [switch] $Release,
    [switch] $ExcludeRazor,
    [switch] $ExcludeDotLiquid,
    [switch] $ExcludeTests,
    [switch] $ExcludeSamples,
    [switch] $Pack,
    [switch] $Run,
    [switch] $OnlyNetStandard
)

$ErrorActionPreference = "Stop"

# ----------------------------------------------
# Helper functions
# ----------------------------------------------

function Invoke-Cmd ($cmd)
{
    Write-Host $cmd -ForegroundColor DarkCyan
    if ([environment]::OSVersion.Platform -eq "Unix")
    {
        Invoke-Expression -Command $cmd
    }
    else
    {
        $command = "cmd.exe /C $cmd"
        Invoke-Expression -Command $command
        if ($LastExitCode -ne 0) { Write-Error "An error occured when executing '$cmd'."; return }
    }
}

function Write-DotnetVersion
{
    $dotnetVersion = Invoke-Cmd "dotnet --version"
    Write-Host ".NET Core runtime version: $dotnetVersion" -ForegroundColor Cyan
}

function dotnet-restore ($project, $argv) { Invoke-Cmd "dotnet restore $project $argv" }
{'fraction_non_alphanumeric': 0.2620778110303549, 'fraction_numerical': 0.0012825994014536127, 'mean_word_length': 1.733644859813084, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3561572', 'n_tokens_mistral': 665, 'n_tokens_neox': 654, 'n_words': 170}