Skip to content

Commit e60b6ae

Browse files
authored
Merge pull request litedb-org#2476 from Pysis868/fix-exit-shell-send-etx
Fix crash in shell when using ctl+c
2 parents 610e530 + 4212782 commit e60b6ae

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

LiteDB.Shell/Shell/InputCommand.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
3-
using System.Diagnostics;
43

54
namespace LiteDB.Shell
65
{
@@ -24,7 +23,16 @@ public string ReadCommand()
2423
Console.ForegroundColor = ConsoleColor.White;
2524
Console.Write("> ");
2625

27-
var cmd = this.ReadLine().Trim();
26+
var cmd = this.ReadLine();
27+
28+
if (cmd == null)
29+
{
30+
this.AutoExit = true;
31+
this.Running = false;
32+
return "";
33+
}
34+
35+
cmd = cmd.Trim();
2836

2937
// single line only for shell commands
3038
if (ShellProgram.GetCommand(cmd) == null)

0 commit comments

Comments
 (0)