예제 #1
0
 public void Launch(List <string> cmdArgs, bool useExternalConsole, Action <int?> launchCompleteAction, Action <string> launchFailureAction, Logger logger)
 {
     if (HostRunInTerminal.IsRunInTerminalAvailable())
     {
         HostRunInTerminal.RunInTerminal(_title, string.Empty, useExternalConsole, cmdArgs, new ReadOnlyDictionary <string, string>(_environment), launchCompleteAction, launchFailureAction);
     }
 }
예제 #2
0
        private static void AddBaseLaunchOptionsAttributes(
            StringBuilder xmlLaunchOptions,
            JsonBaseLaunchOptions jsonLaunchOptions,
            string program,
            string workingDirectory)
        {
            xmlLaunchOptions.Append(String.Concat("  ExePath='", XmlSingleQuotedAttributeEncode(program), "'\n"));

            if (!String.IsNullOrEmpty(workingDirectory))
            {
                xmlLaunchOptions.Append(String.Concat("  WorkingDirectory='", XmlSingleQuotedAttributeEncode(workingDirectory), "'\n"));
            }

            if (jsonLaunchOptions.TargetArchitecture != null)
            {
                xmlLaunchOptions.Append(String.Concat("  TargetArchitecture='", jsonLaunchOptions.TargetArchitecture, "'\n"));
            }

            if (jsonLaunchOptions.VisualizerFile != null)
            {
                xmlLaunchOptions.Append(String.Concat("  VisualizerFile='", jsonLaunchOptions.VisualizerFile, "'\n"));
            }

            if (jsonLaunchOptions.ShowDisplayString)
            {
                xmlLaunchOptions.Append(" ShowDisplayString='true'\n");
            }

            if (jsonLaunchOptions.AdditionalSOLibSearchPath != null)
            {
                xmlLaunchOptions.Append(String.Concat("  AdditionalSOLibSearchPath='", jsonLaunchOptions.AdditionalSOLibSearchPath, "'\n"));
            }

            if (!String.IsNullOrWhiteSpace(jsonLaunchOptions.CoreDumpPath))
            {
                xmlLaunchOptions.Append(String.Concat(" CoreDumpPath='", jsonLaunchOptions.CoreDumpPath, "'\n"));
            }

            string[] exeArgsArray = jsonLaunchOptions.Args;

            // Check to see if we need to redirect app stdin/out/err in Windows case for IntegratedTerminalSupport.
            if (Utilities.IsWindows() &&
                HostRunInTerminal.IsRunInTerminalAvailable() &&
                jsonLaunchOptions is JsonLocalLaunchOptions &&
                String.IsNullOrWhiteSpace(jsonLaunchOptions.CoreDumpPath))
            {
                var localLaunchOptions = (JsonLocalLaunchOptions)jsonLaunchOptions;

                if (localLaunchOptions.ProcessId == 0 && // Only when launching the debuggee
                    !localLaunchOptions.ExternalConsole &&
                    !localLaunchOptions.AvoidWindowsConsoleRedirection)
                {
                    exeArgsArray = TryAddWindowsDebuggeeConsoleRedirection(exeArgsArray);
                }
            }

            // ExeArguments
            // Build the exe's argument list as a string
            StringBuilder exeArguments = new StringBuilder();

            exeArguments.Append(CreateArgumentList(exeArgsArray));
            XmlSingleQuotedAttributeEncode(exeArguments);
            xmlLaunchOptions.Append(String.Concat("  ExeArguments='", exeArguments, "'\n"));

            if (jsonLaunchOptions.MIMode != null)
            {
                xmlLaunchOptions.Append(String.Concat("  MIMode='", jsonLaunchOptions.MIMode, "'\n"));
            }
        }