Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CLI cleanup #179

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions WreckCli/Controller/CliController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ public override void Run(CorrectionMode mode, FileSystemInfo fsi)

CliWorker pw = new CliWorker(task, fsi);
pw.AddPropertyChangeListener(propertyChangeListener);

// HACK: Worker must save the reference before Execute as this is single-threaded.
// Saving the Worker after Execute is useless as
// PropertyChangeListener PropertyChange() will be triggered to do
// cleanup immediately within Execute before the reference to the
// worker is saved, which will cause controller.Done() call to be
// skipped.
Worker = pw; // Need to save to Worker for cleanup later.
pw.Execute();
}

Expand All @@ -98,6 +106,12 @@ public void PropertyChange(PropertyChangeEvent evt)
LOG.InfoFormat(
"State = {0}",
Enum.GetName(typeof(CliWorker.StateValue), state));

if(CliWorker.StateValue.Done.Equals(state))
{
if(controller.Worker != null && controller.Worker.IsDone())
controller.Done();
}
}
else if (R.Strings.PropertyProgress.Equals(evt.PropertyName))
{
Expand Down
2 changes: 1 addition & 1 deletion WreckCli/WreckCli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<AppDesignerFolder>Properties</AppDesignerFolder>
<SourceAnalysisOverrideSettingsFile>C:\Users\USER\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile>
<StartArguments>"C:\Users\Public"</StartArguments>
<StartArguments>"C:\temp\Public"</StartArguments>
<StartupObject>Wreck.Program</StartupObject>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
Expand Down