additional logging

This commit is contained in:
Jon Sequeira 2017-03-07 07:10:12 -08:00
parent 3dafe9a6e2
commit c176b5953f
2 changed files with 29 additions and 21 deletions

View file

@ -80,6 +80,8 @@ namespace Microsoft.DotNet.Cli
UseShellExecute = false UseShellExecute = false
}; };
Reporter.Verbose.WriteLine($"[Forwarding] {processInfo.FileName} {processInfo.Arguments}");
if (_environmentVariables != null) if (_environmentVariables != null)
{ {
foreach (var entry in _environmentVariables) foreach (var entry in _environmentVariables)

View file

@ -13,30 +13,36 @@ namespace Microsoft.DotNet.Cli
public class CompleteCommand public class CompleteCommand
{ {
public static int Run(string[] args) public static int Run(string[] args)
{
try
{ {
DebugHelper.HandleDebugSwitch(ref args); DebugHelper.HandleDebugSwitch(ref args);
// get the parser for the current subcommand // get the parser for the current subcommand
var completeCommandParser = Parser.DotnetCommand["complete"]; var parser = Parser.DotnetCommand["complete"];
// parse the arguments // parse the arguments
var result = completeCommandParser.Parse(args); var result = parser.Parse(args);
var complete = result["complete"]; var complete = result["complete"];
var suggestions = Suggestions(complete); var suggestions = Suggestions(complete);
#if DEBUG
var log = new StringBuilder(); var log = new StringBuilder();
log.AppendLine($"args: {string.Join(" ", args.Select(a => $"\"{a}\""))}"); log.AppendLine($"args: {string.Join(" ", args.Select(a => $"\"{a}\""))}");
log.AppendLine("diagram: " + result.Diagram()); log.AppendLine("diagram: " + result.Diagram());
File.WriteAllText("parse.log", log.ToString()); File.WriteAllText("parse.log", log.ToString());
#endif
foreach (var suggestion in suggestions) foreach (var suggestion in suggestions)
{ {
Console.WriteLine(suggestion); Console.WriteLine(suggestion);
} }
}
catch (Exception e)
{
File.WriteAllText("dotnet completion exception.log", e.ToString());
throw;
}
return 0; return 0;
} }