Skip to content

Commit

Permalink
Merge pull request litedb-org#2476 from Pysis868/fix-exit-shell-send-etx
Browse files Browse the repository at this point in the history
Fix crash in shell when using ctl+c
  • Loading branch information
JKamsker authored Jun 11, 2024
2 parents 610e530 + 4212782 commit e60b6ae
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions LiteDB.Shell/Shell/InputCommand.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;

namespace LiteDB.Shell
{
Expand All @@ -24,7 +23,16 @@ public string ReadCommand()
Console.ForegroundColor = ConsoleColor.White;
Console.Write("> ");

var cmd = this.ReadLine().Trim();
var cmd = this.ReadLine();

if (cmd == null)
{
this.AutoExit = true;
this.Running = false;
return "";
}

cmd = cmd.Trim();

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

0 comments on commit e60b6ae

Please sign in to comment.