Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- **The GemDB Shell no longer prints the database client's own chatter.**
Opening a shell wrote a line like
`gcits login: session 0x… lgc 0x… rpc gem processId 4726` onto your terminal
between the banner and the first prompt, with a matching one on exit — the
client library narrating itself. Every session GemDB opens now asks it not
to.

## [1.2.0] - 2026-08-27

A notebook is a unit of work again: each one gets its own database session, and
Expand Down
5 changes: 5 additions & 0 deletions src/__integration__/repl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ send "exit()\\r"
expect(ran.transcript).toContain('42');
expect(ran.transcript).toContain('marco polo');
expect(ran.transcript).toContain('KeyboardInterrupt');
// The client library narrates every login and logout on stdout unless the
// session asks it not to (GCI_LOGIN_QUIET, session.ts). This is the one
// place that shows: the shell's stdout is the user's terminal, so the
// chatter would land between the banner and the first prompt.
expect(ran.transcript).not.toContain('gcits');
expect(ran.code).toBe(0);
expect(isRunning()).toBe(true); // the shell brought the stone up itself
});
Expand Down
19 changes: 18 additions & 1 deletion src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,23 @@ export class SessionLimitError extends SessionError {}
*/
const SESSION_LIMIT_ERRORS = new Set([4039, 4041, 4050]);

/**
* `GCI_LOGIN_QUIET` — stop the client library narrating each login on stdout.
*
* Without it every login writes a line like
* `gcits login: session 0x… lgc 0x… rpc gem processId 4726` (and a matching
* one at logout) to the process's real stdout, from inside the C library. In
* the extension host that is merely noise in the log; in a GemDB Shell it is
* printed straight onto the user's terminal, and in `gemdb -c` it lands in
* output a script may be piping somewhere.
*
* Defined here rather than in `gci/gciConstants.ts` because that directory is
* vendored from Jasper byte-for-byte and carries no login flags at all. The
* value is from the engine's own `include/gci.ht` (`GCI_LOGIN_QUIET = 0x10`,
* in the flag enum `GciTsLogin`'s `loginFlags` takes).
*/
const GCI_LOGIN_QUIET = 0x10;

/** What kind of user interface a session belongs to. */
export type SessionKind = 'notebook' | 'shell' | 'extension';

Expand Down Expand Up @@ -400,7 +417,7 @@ export class GciSession {
gemNrs(),
DB_USER,
DB_PASSWORD,
0,
GCI_LOGIN_QUIET,
0,
);
if (!result.session) {
Expand Down