fix UseShellExecute problem
This commit is contained in:
@@ -43,10 +43,10 @@ namespace Shadowsocks.Controller
|
||||
_process.StartInfo.FileName = temppath + "/ss_polipo.exe";
|
||||
_process.StartInfo.Arguments = "-c \"" + temppath + "/polipo.conf\"";
|
||||
_process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
_process.StartInfo.UseShellExecute = false;
|
||||
_process.StartInfo.UseShellExecute = true;
|
||||
_process.StartInfo.CreateNoWindow = true;
|
||||
_process.StartInfo.RedirectStandardOutput = true;
|
||||
_process.StartInfo.RedirectStandardError = true;
|
||||
//_process.StartInfo.RedirectStandardOutput = true;
|
||||
//_process.StartInfo.RedirectStandardError = true;
|
||||
_process.Start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,12 +58,19 @@ namespace Shadowsocks.Controller
|
||||
// some logic in configuration updated the config when saving, we need to read it again
|
||||
_config = Configuration.Load();
|
||||
|
||||
pacServer.Stop();
|
||||
local.Stop();
|
||||
|
||||
// don't put polipoRunner.Start() before pacServer.Stop()
|
||||
// or bind will fail when switching bind address from 0.0.0.0 to 127.0.0.1
|
||||
// though UseShellExecute is set to true now
|
||||
// http://stackoverflow.com/questions/10235093/socket-doesnt-close-after-application-exits-if-a-launched-process-is-open
|
||||
polipoRunner.Stop();
|
||||
polipoRunner.Start(_config);
|
||||
|
||||
local = new Local(_config);
|
||||
local.Start();
|
||||
pacServer.Start(_config);
|
||||
|
||||
if (ConfigChanged != null)
|
||||
{
|
||||
@@ -98,8 +105,6 @@ namespace Shadowsocks.Controller
|
||||
{
|
||||
_config.shareOverLan = enabled;
|
||||
SaveConfig(_config);
|
||||
pacServer.Stop();
|
||||
pacServer.Start(_config);
|
||||
if (ShareOverLANStatusChanged != null)
|
||||
{
|
||||
ShareOverLANStatusChanged(this, new EventArgs());
|
||||
|
||||
Reference in New Issue
Block a user