Skip to content

Pressing Ctrl+C while receiving query results closes the whole Console application #288

@farost

Description

@farost

Description

When the Console prints query results, pressing Ctrl+C closes the whole application instead of interrupting the query and/or closing the transaction.

Environment

  1. TypeDB distribution: Core
  2. TypeDB version: 3.2.0-rc2
  3. Environment: Mac
  4. Console version: 3.2.0-rc
  5. Other details:

Reproducible Steps

  1. Set up
    Check that pressing Ctrl+C in an open transaction works correctly:
Welcome to TypeDB Console!

>> transaction read a
a::read>> # press Ctrl+C 
>>  # we existed the transaction, it's the first REPL again. We can do it multiple times:

>> transaction read a
a::read>> 
>> transaction read a
a::read>> 
>> transaction read a
a::read>> 
>> 

Prepare a big data set so your read query runs at least for a couple of seconds. E.g.:

define

attribute name,
 value string;
attribute id,
 value string;
entity person,
  owns id @card(0..),
  owns name;

And insert thousands of

insert $p isa person, has name "Alice", has id "1";
  1. Execute
    Open a transaction:
a::read>>

Run a read query:

a::read>> match { $p isa person; } or { $p isa person, has name "John"; }; not {$p has id "5";}; not {$p has $n;}; $n isa name; $n == "Bob";

Press Enter twice and press Ctrl+C while seeing the answers being printed.

  1. Unexpected result

The whole app is closed:

    $p | isa person, iid 0x1e00000000000000009fe9
   --------
    $n | isa name "Bob"
    $p | isa person, iid 0x1e00000000000000009fea
   --------
^C
λ ~/Downloads/typedb-all-mac-x86_64-3.2.0-rc2/ 

Expected result

We are back to the first REPL:

    $p | isa person, iid 0x1e00000000000000009fe9
   --------
    $n | isa name "Bob"
    $p | isa person, iid 0x1e00000000000000009fea
   --------
^C
>> 

and we can continue working with the driver.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions