27 lines
858 B
C#
27 lines
858 B
C#
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using System;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
|
|
namespace Microsoft.AspNetCore.Razor.Tools
|
|
{
|
|
internal static class DebugMode
|
|
{
|
|
public static void HandleDebugSwitch(ref string[] args)
|
|
{
|
|
if (args.Length > 0 && string.Equals("--debug", args[0], StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
args = args.Skip(1).ToArray();
|
|
|
|
Console.WriteLine("Waiting for debugger in pid: {0}", Process.GetCurrentProcess().Id);
|
|
while (!Debugger.IsAttached)
|
|
{
|
|
Thread.Sleep(TimeSpan.FromSeconds(3));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |