File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
AquaMai.Mods/GameSystem/Assets Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -236,15 +236,29 @@ private static async Task<Texture2D> JacketPostProcess(Texture2D jacket) {
236236 } ;
237237 using var process = new System . Diagnostics . Process { StartInfo = startInfo } ;
238238 process . Start ( ) ;
239- await Task . Run ( ( ) => process . WaitForExit ( ) ) ;
239+
240+ // Wait for process exit with 4.5 second timeout
241+ var exitTask = Task . Run ( ( ) => process . WaitForExit ( ) ) ;
242+ var timeoutTask = Task . Delay ( TimeSpan . FromSeconds ( 4.5 ) ) ;
243+
244+ if ( await Task . WhenAny ( exitTask , timeoutTask ) == timeoutTask ) {
245+ // Timeout occurred
246+ try {
247+ if ( ! process . HasExited ) process . Kill ( ) ;
248+ } catch ( Exception e ) {
249+ MelonLogger . Msg ( $ "[MovieLoader] failed to kill post-process: { e . Message } ") ;
250+ }
251+ MelonLogger . Msg ( $ "[MovieLoader] post-process timeout") ;
252+ return null ;
253+ }
240254
241255 if ( process . ExitCode == 0 && File . Exists ( outputPath ) ) {
242256 // Load processed texture
243257 var processedTexture = new Texture2D ( 1 , 1 , TextureFormat . RGBA32 , false ) ;
244258 processedTexture . LoadImage ( File . ReadAllBytes ( outputPath ) ) ;
245259 jacket = processedTexture ;
246260 } else {
247- MelonLogger . Msg ( $ "[MovieLoader] post-process failed: { process . ExitCode } ") ;
261+ MelonLogger . Msg ( $ "[MovieLoader] post-process failed, ExitCode : { process . ExitCode } ") ;
248262 return null ;
249263 }
250264
You can’t perform that action at this time.
0 commit comments