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: Screen Rendering on Invalid Arguments #3148

Merged
merged 3 commits into from
Feb 20, 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
7 changes: 3 additions & 4 deletions src/Neo.CLI/CLI/MainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,10 @@ private byte[] LoadUpdateScript(UInt160 scriptHash, string nefFilePath, string m
}
}

public override void OnStart(string[] args)
public override bool OnStart(string[] args)
{
base.OnStart(args);
OnStartWithCommandLine(args);

if (!base.OnStart(args)) return false;
return OnStartWithCommandLine(args) != 1;
}

public override void OnStop()
Expand Down
10 changes: 5 additions & 5 deletions src/Neo.ConsoleService/ConsoleServiceBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,13 @@ protected void OnExit()

#endregion

public virtual void OnStart(string[] args)
public virtual bool OnStart(string[] args)
{
// Register sigterm event handler
AssemblyLoadContext.Default.Unloading += SigTermEventHandler;
// Register sigint event handler
Console.CancelKeyPress += CancelHandler;
return true;
}

public virtual void OnStop()
Expand Down Expand Up @@ -428,7 +429,7 @@ public void Run(string[] args)
{
if (Environment.UserInteractive)
{
if (args.Length > 0 && args[0] == "/install")
if (args.Length == 1 && args[0] == "/install")
{
if (Environment.OSVersion.Platform != PlatformID.Win32NT)
{
Expand Down Expand Up @@ -457,7 +458,7 @@ public void Run(string[] args)
Console.Write(process.StandardOutput.ReadToEnd());
}
}
else if (args.Length > 0 && args[0] == "/uninstall")
else if (args.Length == 1 && args[0] == "/uninstall")
{
if (Environment.OSVersion.Platform != PlatformID.Win32NT)
{
Expand All @@ -483,8 +484,7 @@ public void Run(string[] args)
}
else
{
OnStart(args);
RunConsole();
if (OnStart(args)) RunConsole();
OnStop();
}
}
Expand Down
Loading