System.Data.SQLite
Check-in [81a7bf254e]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Simplify diagnostics for the Process/ProcessStartInfo classes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | vsNoNetFxFlags
Files: files | file ages | folders
SHA1: 81a7bf254e690e13d746bcf09336c36ac1b628bb
User & Date: mistachkin 2013-12-28 07:13:18
Context
2013-12-28
07:35
Enhance diagnostic message formatting, especially for the newly supported ProcessStartInfo/DataReceivedEventArgs classes. check-in: 871b73784d user: mistachkin tags: vsNoNetFxFlags
07:13
Simplify diagnostics for the Process/ProcessStartInfo classes. check-in: 81a7bf254e user: mistachkin tags: vsNoNetFxFlags
04:48
Minor adjustments to the previous commit. check-in: 07ed13a08f user: mistachkin tags: vsNoNetFxFlags
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to tools/install/Installer.cs.

  4098   4098               }
  4099   4099               else if (type == typeof(Version))
  4100   4100               {
  4101   4101                   Version version = (Version)value;
  4102   4102   
  4103   4103                   result = String.Format("v{0}", version);
  4104   4104               }
         4105  +            else if (type == typeof(ProcessStartInfo))
         4106  +            {
         4107  +                ProcessStartInfo startInfo = (ProcessStartInfo)value;
         4108  +
         4109  +                result = String.Format(
         4110  +                    "fileName = {0}, arguments = {1}, workingDirectory = {2}, " +
         4111  +                    "useShellExecute = {3}, redirectStandardOutput = {4}, " +
         4112  +                    "redirectStandardError = {5}", startInfo.FileName,
         4113  +                    startInfo.Arguments, startInfo.WorkingDirectory,
         4114  +                    startInfo.UseShellExecute, startInfo.RedirectStandardOutput,
         4115  +                    startInfo.RedirectStandardError);
         4116  +            }
         4117  +            else if (type == typeof(Process))
         4118  +            {
         4119  +                Process process = (Process)value;
         4120  +
         4121  +                result = process.Id.ToString();
         4122  +            }
         4123  +            else if (type == typeof(DataReceivedEventArgs))
         4124  +            {
         4125  +                DataReceivedEventArgs eventArgs = (DataReceivedEventArgs)value;
         4126  +
         4127  +                result = eventArgs.Data;
         4128  +            }
  4105   4129               else
  4106   4130               {
  4107   4131                   result = value.ToString();
  4108   4132   
  4109   4133                   if (result.Length == 0)
  4110   4134                       return "<empty>";
  4111   4135   
................................................................................
  6185   6209               DataReceivedEventArgs e
  6186   6210               )
  6187   6211           {
  6188   6212               Process process = sender as Process;
  6189   6213   
  6190   6214               TraceOps.DebugAndTrace(TracePriority.Medium,
  6191   6215                   debugCallback, traceCallback, String.Format(
  6192         -                VsDevEnvSetupFormat, process.Id, e.Data),
  6193         -                traceCategory);
         6216  +                VsDevEnvSetupFormat, ForDisplay(process),
         6217  +                ForDisplay(e)), traceCategory);
  6194   6218           }
  6195   6219   
  6196   6220           ///////////////////////////////////////////////////////////////////////
  6197   6221   
  6198   6222           private static void VsDevEnvSetupErrorDataReceived(
  6199   6223               object sender,
  6200   6224               DataReceivedEventArgs e
  6201   6225               )
  6202   6226           {
  6203   6227               Process process = sender as Process;
  6204   6228   
  6205   6229               TraceOps.DebugAndTrace(TracePriority.Medium,
  6206   6230                   debugCallback, traceCallback, String.Format(
  6207         -                VsDevEnvSetupFormat, process.Id, e.Data),
  6208         -                traceCategory);
         6231  +                VsDevEnvSetupFormat, ForDisplay(process),
         6232  +                ForDisplay(e)), traceCategory);
  6209   6233           }
  6210   6234   
  6211   6235           ///////////////////////////////////////////////////////////////////////
  6212   6236   
  6213   6237           private static bool AddVsDevEnvSetup(
  6214   6238               Version vsVersion,
  6215   6239               string directory,
................................................................................
  6254   6278               //       redirected, so it can be logged properly.
  6255   6279               //
  6256   6280               startInfo.UseShellExecute = false;
  6257   6281               startInfo.RedirectStandardOutput = true;
  6258   6282               startInfo.RedirectStandardError = true;
  6259   6283   
  6260   6284               Process process = new Process();
         6285  +
         6286  +            process.StartInfo = startInfo;
  6261   6287   
  6262   6288               process.OutputDataReceived += new DataReceivedEventHandler(
  6263   6289                   VsDevEnvSetupOutputDataReceived);
  6264   6290   
  6265   6291               process.ErrorDataReceived += new DataReceivedEventHandler(
  6266   6292                   VsDevEnvSetupErrorDataReceived);
  6267   6293   
  6268   6294               if (verbose)
  6269   6295                   TraceOps.DebugAndTrace(TracePriority.Highest,
  6270         -                    debugCallback, traceCallback, String.Format(
  6271         -                    "fileName = {0}, arguments = {1}, " +
  6272         -                    "workingDirectory = {2}, useShellExecute = {3}, " +
  6273         -                    "redirectStandardOutput = {4}, " +
  6274         -                    "redirectStandardError = {5}", ForDisplay(
  6275         -                    startInfo.FileName), ForDisplay(startInfo.Arguments),
  6276         -                    ForDisplay(startInfo.WorkingDirectory), ForDisplay(
  6277         -                    startInfo.UseShellExecute), ForDisplay(
  6278         -                    startInfo.RedirectStandardOutput), ForDisplay(
  6279         -                    startInfo.RedirectStandardError)), traceCategory);
         6296  +                    debugCallback, traceCallback, ForDisplay(startInfo),
         6297  +                    traceCategory);
  6280   6298   
  6281   6299               //
  6282   6300               // NOTE: In 'what-if' mode, do not actually start the process.
  6283   6301               //
  6284   6302               if (!whatIf)
  6285   6303               {
  6286   6304                   process.Start();
         6305  +
         6306  +                if (verbose)
         6307  +                    TraceOps.DebugAndTrace(TracePriority.Highest,
         6308  +                        debugCallback, traceCallback, String.Format(
         6309  +                        "process = {0}", ForDisplay(process)),
         6310  +                        traceCategory);
         6311  +
  6287   6312                   process.BeginOutputReadLine();
  6288   6313                   process.BeginErrorReadLine();
  6289   6314                   process.WaitForExit();
  6290   6315               }
  6291   6316   
  6292   6317               return true;
  6293   6318           }