Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
yibei333 committed Dec 5, 2024
1 parent 1ef17d9 commit 8027143
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion assets/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.9.6-alpha
1.1.0
2 changes: 1 addition & 1 deletion src/SingleExe.Tool/SingleExe.Tool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<Version>1.0.9.6-alpha</Version>
<Version>1.1.0</Version>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
<PackageReadmeFile>Nuget.md</PackageReadmeFile>
<AssemblyName>single-exe</AssemblyName>
Expand Down
4 changes: 2 additions & 2 deletions src/SingleExe/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public void Run()
{
Console.WriteLine(ex.Message);
}
Clean();
}

void CheckRole()
Expand Down Expand Up @@ -128,13 +127,14 @@ void StartProcess()
if (!string.IsNullOrWhiteSpace(args.Data)) Console.WriteLine($"error: {args.Data}");
};
ChildProcess = process;
process.Exited += (s, e) => Clean();
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
process.WaitForExit();
}

public void Clean()
void Clean()
{
if (IsOtherProcessExist()) return;
if (!Directory.Exists(AppRootFolder)) return;
Expand Down
2 changes: 1 addition & 1 deletion src/SingleExe/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ public static class Config
public static string Name = "SampleApp";
public static string Version = "1.0.0";
public static string EntryPoint = "SampleApp.exe";
public static bool IsCommandLine = false;
public static bool IsCommandLine = true;
public static bool IsRequireAdmin = false;
}
3 changes: 1 addition & 2 deletions src/SingleExe/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ static void Main(string[] args)
var app = new App(args);
AppDomain.CurrentDomain.ProcessExit += (s, e) =>
{
app.ChildProcess.Close();
app.Clean();
if(app.ChildProcess is not null && !app.ChildProcess.HasExited) app.ChildProcess.Close();
};

app.Run();
Expand Down

0 comments on commit 8027143

Please sign in to comment.