From 6e6dd10a674ebbe73c8f76c01fa0778a39f9772e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Rivero?= Date: Mon, 1 Jul 2019 11:36:57 -0700 Subject: [PATCH] If file exists, then overwrite it. (#374) --- .../dotnet-trace/CommandLine/Commands/CollectCommand.cs | 6 +----- src/Tools/dotnet-trace/CommandLine/Commands/ErrorCode.cs | 9 ++++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs b/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs index 13d4d286c..81ad437d2 100644 --- a/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs +++ b/src/Tools/dotnet-trace/CommandLine/Commands/CollectCommand.cs @@ -111,11 +111,7 @@ namespace Microsoft.Diagnostics.Tools.Trace Console.Error.WriteLine("Unable to create session."); return ErrorCodes.SessionCreationError; } - if (File.Exists(output.FullName)) - { - Console.Error.WriteLine($"Unable to create file {output.FullName}. Try using -o or --output option to specify a different output file name."); - return ErrorCodes.FileCreationError; - } + var collectingTask = new Task(() => { try { diff --git a/src/Tools/dotnet-trace/CommandLine/Commands/ErrorCode.cs b/src/Tools/dotnet-trace/CommandLine/Commands/ErrorCode.cs index de806c695..d3400a332 100644 --- a/src/Tools/dotnet-trace/CommandLine/Commands/ErrorCode.cs +++ b/src/Tools/dotnet-trace/CommandLine/Commands/ErrorCode.cs @@ -6,10 +6,9 @@ namespace Microsoft.Diagnostics.Tools.Trace { internal static class ErrorCodes { - public static int SessionCreationError = 1; - public static int FileCreationError = 2; - public static int TracingError = 3; - public static int ArgumentError = 4; - public static int UnknownError = 5; + public const int SessionCreationError = 1; + public const int TracingError = 2; + public const int ArgumentError = 3; + public const int UnknownError = 4; } } \ No newline at end of file -- 2.34.1