Skip to content

Commit

Permalink
Fix: Screen Rendering on Invalid Arguments (#3148)
Browse files Browse the repository at this point in the history
* Fix #3135

* clean

* check base
  • Loading branch information
shargon authored Feb 20, 2024
1 parent 3f002a6 commit ffa56fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
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

0 comments on commit ffa56fe

Please sign in to comment.