more resilient
This commit is contained in:
parent
d9e875ed10
commit
43bcc27137
17
Program.cs
17
Program.cs
@ -39,7 +39,7 @@ namespace directors_assistant
|
||||
justArgs.AddRange(ec.args);
|
||||
var commandPath = cmdAndArgs[0];
|
||||
var commandArguments = String.Join(' ', justArgs);
|
||||
if (ec.timeout > TimeSpan.Zero)
|
||||
if (ec.timeout != null && ec.timeout > TimeSpan.Zero)
|
||||
{
|
||||
executeTimed(cmd.name, commandPath, commandArguments, ec.timeout);
|
||||
}
|
||||
@ -72,7 +72,7 @@ namespace directors_assistant
|
||||
process.Start();
|
||||
process.BeginErrorReadLine();
|
||||
process.BeginOutputReadLine();
|
||||
if (timeout > TimeSpan.Zero)
|
||||
if (timeout != null && timeout > TimeSpan.Zero)
|
||||
{
|
||||
Task.WaitAny(
|
||||
Task.Run(() =>
|
||||
@ -145,6 +145,8 @@ namespace directors_assistant
|
||||
});
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
stopwatch.Start();
|
||||
process.Start();
|
||||
process.BeginErrorReadLine();
|
||||
@ -159,6 +161,17 @@ namespace directors_assistant
|
||||
exit_code = process.ExitCode
|
||||
});
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Console.Error.WriteLine($"{commandName} FATAL: {JsonConvert.SerializeObject(e)}");
|
||||
telefranz.ProduceMessage(new silver_messages.directorial.command_error()
|
||||
{
|
||||
stderr = e.Message,
|
||||
command = commandName,
|
||||
runtime = (uint)stopwatch.ElapsedMilliseconds
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static Process readableProcess(string commandPath, string commandArguments)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user