Skip to content

Commit

Permalink
Added more logging for potential failures on starting the watcher ser…
Browse files Browse the repository at this point in the history
…vice.
  • Loading branch information
RandomEngy committed Sep 11, 2022
1 parent 2e7ec6c commit 3ad1e03
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
2 changes: 1 addition & 1 deletion VidCoder/Services/HandBrakeProxy/RemoteProxyBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ private async Task<bool> ConnectToPipeAsync()
this.Client = new PipeClientWithCallback<TWork, TCallback>(new NetJsonPipeSerializer(), this.pipeName, () => this.CallbackInstance);

// With extended logging, log the pipe messages.
if (Config.LogVerbosity >= 2)
if (Utilities.DebugLogging)
{
this.Client.SetLogger(message =>
{
Expand Down
25 changes: 25 additions & 0 deletions VidCoder/Services/WatcherProcessManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,37 @@ public void Start(bool refreshStatus = true)

this.Status = WatcherProcessStatus.Starting;
this.watcherProcess = Process.Start(startInfo);
if (this.watcherProcess == null)
{
this.logger.LogError("Watcher process start returned null.");
return;
}

Task.Run(async () =>
{
if (this.watcherProcess.HasExited)
{
this.logger.LogError("Watcher process immediately exited with code " + this.watcherProcess.ExitCode);
return;
}
// When the process writes out a line, its pipe server is ready.
if (Utilities.DebugLogging)
{
this.logger.Log("Waiting for watcher process to output a line.");
}
await this.watcherProcess.StandardOutput.ReadLineAsync();
if (Utilities.DebugLogging)
{
this.logger.Log("Line read from watcher process. Connecting now...");
}
await this.ConnectToServiceAsync();
if (Utilities.DebugLogging)
{
this.logger.Log("Connection succeeded. Watcher process is running.");
}
this.Status = WatcherProcessStatus.Running;
this.StartPolling();
});
Expand Down
5 changes: 5 additions & 0 deletions VidCoder/Utilities/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ public static Version CurrentVersion
get { return Assembly.GetExecutingAssembly().GetName().Version; }
}

public static bool DebugLogging
{
get => Config.LogVerbosity >= 2;
}

/// <summary>
/// Displays version number with optional Beta marker.
/// </summary>
Expand Down
6 changes: 5 additions & 1 deletion VidCoder/View/Main.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2033,7 +2033,11 @@
Margin="0 0 6 0"
VerticalAlignment="Center"
Text="{Binding QueueAdderService.ProgressLabel}" />
<ProgressBar Grid.Column="1" Value="{Binding QueueAdderService.Progress, Mode=OneWay}" />
<ProgressBar
Grid.Column="1"
Background="{DynamicResource WindowBrush}"
Foreground="{Binding ProcessingService.ProgressBarBrush}"
Value="{Binding QueueAdderService.Progress, Mode=OneWay}" />
<Button
Grid.Column="2"
Margin="10 0 0 0"
Expand Down

0 comments on commit 3ad1e03

Please sign in to comment.