System.Data.SQLite

Check-in [81a7bf254e]
Login

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

Overview
Comment:Simplify diagnostics for the Process/ProcessStartInfo classes.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | vsNoNetFxFlags
Files: files | file ages | folders
SHA1: 81a7bf254e690e13d746bcf09336c36ac1b628bb
User & Date: mistachkin 2013-12-28 07:13:18.377
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
Side-by-Side Diff Ignore Whitespace Patch
Changes to tools/install/Installer.cs.
4098
4099
4100
4101
4102
4103
4104
























4105
4106
4107
4108
4109
4110
4111
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







            }
            else if (type == typeof(Version))
            {
                Version version = (Version)value;

                result = String.Format("v{0}", version);
            }
            else if (type == typeof(ProcessStartInfo))
            {
                ProcessStartInfo startInfo = (ProcessStartInfo)value;

                result = String.Format(
                    "fileName = {0}, arguments = {1}, workingDirectory = {2}, " +
                    "useShellExecute = {3}, redirectStandardOutput = {4}, " +
                    "redirectStandardError = {5}", startInfo.FileName,
                    startInfo.Arguments, startInfo.WorkingDirectory,
                    startInfo.UseShellExecute, startInfo.RedirectStandardOutput,
                    startInfo.RedirectStandardError);
            }
            else if (type == typeof(Process))
            {
                Process process = (Process)value;

                result = process.Id.ToString();
            }
            else if (type == typeof(DataReceivedEventArgs))
            {
                DataReceivedEventArgs eventArgs = (DataReceivedEventArgs)value;

                result = eventArgs.Data;
            }
            else
            {
                result = value.ToString();

                if (result.Length == 0)
                    return "<empty>";

6185
6186
6187
6188
6189
6190
6191
6192
6193


6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208


6209
6210
6211
6212
6213
6214
6215
6209
6210
6211
6212
6213
6214
6215


6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230


6231
6232
6233
6234
6235
6236
6237
6238
6239







-
-
+
+













-
-
+
+







            DataReceivedEventArgs e
            )
        {
            Process process = sender as Process;

            TraceOps.DebugAndTrace(TracePriority.Medium,
                debugCallback, traceCallback, String.Format(
                VsDevEnvSetupFormat, process.Id, e.Data),
                traceCategory);
                VsDevEnvSetupFormat, ForDisplay(process),
                ForDisplay(e)), traceCategory);
        }

        ///////////////////////////////////////////////////////////////////////

        private static void VsDevEnvSetupErrorDataReceived(
            object sender,
            DataReceivedEventArgs e
            )
        {
            Process process = sender as Process;

            TraceOps.DebugAndTrace(TracePriority.Medium,
                debugCallback, traceCallback, String.Format(
                VsDevEnvSetupFormat, process.Id, e.Data),
                traceCategory);
                VsDevEnvSetupFormat, ForDisplay(process),
                ForDisplay(e)), traceCategory);
        }

        ///////////////////////////////////////////////////////////////////////

        private static bool AddVsDevEnvSetup(
            Version vsVersion,
            string directory,
6254
6255
6256
6257
6258
6259
6260


6261
6262
6263
6264
6265
6266
6267
6268
6269
6270

6271
6272
6273
6274
6275
6276
6277
6278
6279

6280
6281
6282
6283
6284
6285
6286







6287
6288
6289
6290
6291
6292
6293
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295

6296









6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318







+
+









-
+
-
-
-
-
-
-
-
-
-
+







+
+
+
+
+
+
+







            //       redirected, so it can be logged properly.
            //
            startInfo.UseShellExecute = false;
            startInfo.RedirectStandardOutput = true;
            startInfo.RedirectStandardError = true;

            Process process = new Process();

            process.StartInfo = startInfo;

            process.OutputDataReceived += new DataReceivedEventHandler(
                VsDevEnvSetupOutputDataReceived);

            process.ErrorDataReceived += new DataReceivedEventHandler(
                VsDevEnvSetupErrorDataReceived);

            if (verbose)
                TraceOps.DebugAndTrace(TracePriority.Highest,
                    debugCallback, traceCallback, String.Format(
                    debugCallback, traceCallback, ForDisplay(startInfo),
                    "fileName = {0}, arguments = {1}, " +
                    "workingDirectory = {2}, useShellExecute = {3}, " +
                    "redirectStandardOutput = {4}, " +
                    "redirectStandardError = {5}", ForDisplay(
                    startInfo.FileName), ForDisplay(startInfo.Arguments),
                    ForDisplay(startInfo.WorkingDirectory), ForDisplay(
                    startInfo.UseShellExecute), ForDisplay(
                    startInfo.RedirectStandardOutput), ForDisplay(
                    startInfo.RedirectStandardError)), traceCategory);
                    traceCategory);

            //
            // NOTE: In 'what-if' mode, do not actually start the process.
            //
            if (!whatIf)
            {
                process.Start();

                if (verbose)
                    TraceOps.DebugAndTrace(TracePriority.Highest,
                        debugCallback, traceCallback, String.Format(
                        "process = {0}", ForDisplay(process)),
                        traceCategory);

                process.BeginOutputReadLine();
                process.BeginErrorReadLine();
                process.WaitForExit();
            }

            return true;
        }