actually yes New Thread but move the try-catch

This commit is contained in:
Elijah R 2023-12-10 16:24:10 -05:00
parent 78c5899ac2
commit f01b057b87

View file

@ -77,15 +77,18 @@ namespace CollabVMAgent
#if DEBUG #if DEBUG
Console.WriteLine($"Successfully wrote {msg.Filename} ({msg.FileData.Length} bytes)"); Console.WriteLine($"Successfully wrote {msg.Filename} ({msg.FileData.Length} bytes)");
#endif #endif
try new Thread(() =>
{
Process.Start(UploadsFolder + @"\" + msg.Filename);
} catch (Exception ex)
{ {
try
{
Process.Start(UploadsFolder + @"\" + msg.Filename).Start();
} catch (Exception ex)
{
#if DEBUG #if DEBUG
Console.WriteLine($"Failed to run {msg.Filename}: {ex.Message}"); Console.WriteLine($"Error while starting {msg.Filename}: {ex.Message}");
#endif #endif
} }
}).Start();
break; break;
} }
case ProtocolOperation.NOP: case ProtocolOperation.NOP: