BAKAOLC / Ritsukage-Core

Bot core for ritsukage
GNU Affero General Public License v3.0
5 stars 4 forks source link

Exit successfully even fatal error. #54

Closed KunoSayo closed 1 year ago

KunoSayo commented 1 year ago

Run these commands in order. ubuntu@VM-4-11-ubuntu:~/project/dt$ stty

speed 9600 baud; line = 0;
min = 1; time = 0;
-brkint -icrnl -imaxbel
-icanon -iexten

ubuntu@VM-4-11-ubuntu:~/project/dt$ cat Program.cs

// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
var a = 0;
string s = Console.ReadLine();
Console.WriteLine("Read:");
Console.WriteLine(s);

var x = 1 / a;
// Environment.Exit(-1);

ubuntu@VM-4-11-ubuntu:~/project/dt$ dotnet run

/home/ubuntu/project/dt/Program.cs(4,12): warning CS8600: Converting null literal or possible null value to non-nullable type. [/home/ubuntu/project/dt/dt.csproj]
Hello, World!
123
Read:
123
Unhandled exception. System.DivideByZeroException: Attempted to divide by zero.
   at Program.<Main>$(String[] args) in /home/ubuntu/project/dt/Program.cs:line 8

ubuntu@VM-4-11-ubuntu:~/project/dt$

min = 1; time = 0;
-brkint -icrnl -imaxbel
-icanon -iexten -echo

Observed that -echo. And ... the version.

ubuntu@VM-4-11-ubuntu:~/project/dt$ dotnet --version
7.0.302
ubuntu@VM-4-11-ubuntu:~/project/dt$ uname -a
Linux VM-4-11-ubuntu 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

不知道什么原因,dotnet run读了命令行输入之后报错退出会关掉回显给不会用linux的人带来了很多问号。 希望能够给整点机制保证大部分异常不会直接炸串(try catch..?) 测个ubuntu被炸的哭死

BAKAOLC commented 1 year ago

dotnet/core#8528