Skip to content

Commit 38d61a5

Browse files
askaltLeonidVas
authored andcommitted
connect: fix crash on \q
Fixed crash on `\q` input in `tt connect`. In this case, instance returns an empty response, add a check for this.
1 parent 0cb98cb commit 38d61a5

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1515

1616
- ``tt start`` now does not start an instance if it is already running.
1717
- ``tt rocks`` uses rocks repo path relative to tt environment config location.
18+
- ``tt connect`` now does not crash on `\q` input.
1819

1920
### Added
2021

cli/connect/console.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,10 @@ func getExecutor(console *Console) prompt.Executor {
254254
} else {
255255
log.Fatalf("Failed to execute command: %s", err)
256256
}
257+
} else if len(results) == 0 {
258+
console.Close()
259+
log.Infof("Connection closed")
260+
os.Exit(0)
257261
} else {
258262
data = results[0]
259263
}

0 commit comments

Comments
 (0)