Skip to content

Commit 5c6ec60

Browse files
committed
qwe
1 parent 44ffb14 commit 5c6ec60

2 files changed

Lines changed: 34 additions & 11 deletions

File tree

src/ElectronNET.API/Runtime/Controllers/RuntimeControllerDotNetFirst.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,15 @@ protected override Task StartCore()
4949
ElectronNetRuntime.ElectronSocketPort = this.port;
5050
}
5151

52+
Console.Error.WriteLine("[StartCore]: isUnPacked: {0}", isUnPacked);
53+
Console.Error.WriteLine("[StartCore]: electronBinaryName: {0}", electronBinaryName);
54+
Console.Error.WriteLine("[StartCore]: args: {0}", args);
55+
5256
this.electronProcess = new ElectronProcessActive(isUnPacked, electronBinaryName, args, this.port.Value);
5357
this.electronProcess.Ready += this.ElectronProcess_Ready;
5458
this.electronProcess.Stopped += this.ElectronProcess_Stopped;
5559

60+
Console.Error.WriteLine("[StartCore]: Before Start");
5661
return this.electronProcess.Start();
5762
}
5863

src/ElectronNET.API/Runtime/Services/ElectronProcess/ElectronProcessActive.cs

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,40 @@ protected override Task StopCore()
6868

6969
private async Task StartInternal(string startCmd, string args, string directoriy)
7070
{
71-
await Task.Delay(10).ConfigureAwait(false);
71+
try
72+
{
73+
await Task.Delay(10).ConfigureAwait(false);
7274

73-
this.process = new ProcessRunner("ElectronRunner");
74-
this.process.ProcessExited += this.Process_Exited;
75-
this.process.Run(startCmd, args, directoriy);
75+
Console.Error.WriteLine("[StartInternal]: startCmd: {0}", startCmd);
76+
Console.Error.WriteLine("[StartInternal]: args: {0}", args);
7677

77-
await Task.Delay(500).ConfigureAwait(false);
78+
this.process = new ProcessRunner("ElectronRunner");
79+
this.process.ProcessExited += this.Process_Exited;
80+
this.process.Run(startCmd, args, directoriy);
7881

79-
if (!this.process.IsRunning)
80-
{
81-
Task.Run(() => this.TransitionState(LifetimeState.Stopped));
82+
await Task.Delay(500).ConfigureAwait(false);
8283

83-
throw new Exception("Failed to launch the Electron process.");
84-
}
84+
Console.Error.WriteLine("[StartInternal]: adter run:");
85+
86+
if (!this.process.IsRunning)
87+
{
88+
Console.Error.WriteLine("[StartInternal]: Process is not running: " + this.process.StandardError);
89+
Console.Error.WriteLine("[StartInternal]: Process is not running: " + this.process.StandardOutput);
90+
91+
Task.Run(() => this.TransitionState(LifetimeState.Stopped));
8592

86-
this.TransitionState(LifetimeState.Ready);
93+
throw new Exception("Failed to launch the Electron process.");
94+
}
95+
96+
this.TransitionState(LifetimeState.Ready);
97+
}
98+
catch (Exception ex)
99+
{
100+
Console.Error.WriteLine("[StartInternal]: Exception: " + this.process?.StandardError);
101+
Console.Error.WriteLine("[StartInternal]: Exception: " + this.process?.StandardOutput);
102+
Console.Error.WriteLine("[StartInternal]: Exception: " + ex);
103+
throw;
104+
}
87105
}
88106

89107
private void Process_Exited(object sender, EventArgs e)

0 commit comments

Comments
 (0)