@@ -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