Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/WebServer.cs

Issue 955443003: [VS Addin] Fix error handling on webserver startup error (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 namespace NativeClientVSAddIn 5 namespace NativeClientVSAddIn
6 { 6 {
7 using System; 7 using System;
8 using System.IO; 8 using System.IO;
9 using EnvDTE; 9 using EnvDTE;
10 using Microsoft.VisualStudio.VCProjectEngine; 10 using Microsoft.VisualStudio.VCProjectEngine;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 { 60 {
61 webServerPort = DefaultWebServerPort; 61 webServerPort = DefaultWebServerPort;
62 } 62 }
63 63
64 string webServerExecutable = "python.exe"; 64 string webServerExecutable = "python.exe";
65 string httpd = Path.Combine(properties.SDKRootDirectory, "examples", "http d.py"); 65 string httpd = Path.Combine(properties.SDKRootDirectory, "examples", "http d.py");
66 if (!File.Exists(httpd)) 66 if (!File.Exists(httpd))
67 httpd = Path.Combine(properties.SDKRootDirectory, "tools", "httpd.py") ; 67 httpd = Path.Combine(properties.SDKRootDirectory, "tools", "httpd.py") ;
68 string webServerArguments = httpd + " --no_dir_check " + webServerPort; 68 string webServerArguments = httpd + " --no_dir_check " + webServerPort;
69 69
70 webServerOutputPane_.Clear();
71 webServerOutputPane_.OutputString(Strings.WebServerStartMessage + "\n");
72 webServerOutputPane_.Activate();
73
70 // Start the web server process. 74 // Start the web server process.
71 try 75 try
72 { 76 {
73 webServer_ = new System.Diagnostics.Process(); 77 webServer_ = new System.Diagnostics.Process();
74 webServer_.StartInfo.CreateNoWindow = true; 78 webServer_.StartInfo.CreateNoWindow = true;
75 webServer_.StartInfo.UseShellExecute = false; 79 webServer_.StartInfo.UseShellExecute = false;
76 webServer_.StartInfo.RedirectStandardOutput = true; 80 webServer_.StartInfo.RedirectStandardOutput = true;
77 webServer_.StartInfo.RedirectStandardError = true; 81 webServer_.StartInfo.RedirectStandardError = true;
78 webServer_.StartInfo.FileName = webServerExecutable; 82 webServer_.StartInfo.FileName = webServerExecutable;
79 webServer_.StartInfo.Arguments = webServerArguments; 83 webServer_.StartInfo.Arguments = webServerArguments;
80 webServer_.StartInfo.WorkingDirectory = properties.ProjectDirectory; 84 webServer_.StartInfo.WorkingDirectory = properties.ProjectDirectory;
81 webServer_.OutputDataReceived += WebServerMessageReceive; 85 webServer_.OutputDataReceived += WebServerMessageReceive;
82 webServer_.ErrorDataReceived += WebServerMessageReceive; 86 webServer_.ErrorDataReceived += WebServerMessageReceive;
83 webServer_.Start(); 87 webServer_.Start();
84 webServer_.BeginOutputReadLine(); 88 webServer_.BeginOutputReadLine();
85 webServer_.BeginErrorReadLine(); 89 webServer_.BeginErrorReadLine();
86 } 90 }
87 catch (Exception e) 91 catch (Exception e)
88 { 92 {
89 webServerOutputPane_.OutputString(Strings.WebServerStartFail + "\n"); 93 webServerOutputPane_.OutputString(Strings.WebServerStartFail + "\n");
90 webServerOutputPane_.OutputString("Exception: " + e.Message + "\n"); 94 webServerOutputPane_.OutputString("Exception: " + e.Message + "\n");
91 webServerOutputPane_.Activate();
92 } 95 }
93
94 webServerOutputPane_.Clear();
95 webServerOutputPane_.OutputString(Strings.WebServerStartMessage + "\n");
96 webServerOutputPane_.Activate();
97 } 96 }
98 97
99 /// <summary> 98 /// <summary>
100 /// Finalizer. Should clean up unmanaged resources. Should not be overriden in derived classes. 99 /// Finalizer. Should clean up unmanaged resources. Should not be overriden in derived classes.
101 /// </summary> 100 /// </summary>
102 ~WebServer() 101 ~WebServer()
103 { 102 {
104 Dispose(false); 103 Dispose(false);
105 } 104 }
106 105
(...skipping 28 matching lines...) Expand all
135 /// Receives output from the web server process to display in the Visual Stu dio UI. 134 /// Receives output from the web server process to display in the Visual Stu dio UI.
136 /// </summary> 135 /// </summary>
137 /// <param name="sender">The parameter is not used.</param> 136 /// <param name="sender">The parameter is not used.</param>
138 /// <param name="e">Contains the data to display.</param> 137 /// <param name="e">Contains the data to display.</param>
139 private void WebServerMessageReceive(object sender, System.Diagnostics.DataR eceivedEventArgs e) 138 private void WebServerMessageReceive(object sender, System.Diagnostics.DataR eceivedEventArgs e)
140 { 139 {
141 webServerOutputPane_.OutputString(e.Data + "\n"); 140 webServerOutputPane_.OutputString(e.Data + "\n");
142 } 141 }
143 } 142 }
144 } 143 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698