feat(process): support explicit stdin closure
This commit is contained in:
@@ -1558,6 +1558,7 @@ describe("process capture adapter", () => {
|
||||
},
|
||||
actions: [
|
||||
{ type: "send_input", data: "accepted\n", sensitive: true },
|
||||
{ type: "close_stdin" },
|
||||
],
|
||||
target: { kind: "goto", state: "finishing" },
|
||||
},
|
||||
@@ -1620,6 +1621,13 @@ describe("process capture adapter", () => {
|
||||
outcome: "dispatched",
|
||||
}),
|
||||
);
|
||||
expect(result.value.interaction_events).toContainEqual(
|
||||
expect.objectContaining({
|
||||
type: "stdin_close",
|
||||
data: "",
|
||||
outcome: "dispatched",
|
||||
}),
|
||||
);
|
||||
expect(result.value.frames.map(({ data }) => data).join("")).toContain(
|
||||
"Done",
|
||||
);
|
||||
|
||||
@@ -114,6 +114,7 @@ const createHarness = (scenario: ProcessReactiveScenario) => {
|
||||
write: (data: string) => terminalCalls.push(`write:${data}`),
|
||||
resize: (columns: number, rows: number) =>
|
||||
terminalCalls.push(`resize:${String(columns)}x${String(rows)}`),
|
||||
closeInput: () => terminalCalls.push("close-input"),
|
||||
kill: (signal: "SIGINT" | "SIGTERM" | "SIGKILL") =>
|
||||
terminalCalls.push(`kill:${signal}`),
|
||||
}),
|
||||
@@ -223,6 +224,7 @@ describe("process reactive coordinator", () => {
|
||||
actions: [
|
||||
{ type: "send_input", data: "secret", sensitive: true },
|
||||
{ type: "resize", columns: 100, rows: 40 },
|
||||
{ type: "close_stdin" },
|
||||
{
|
||||
type: "send_signal",
|
||||
target: { kind: "root" },
|
||||
@@ -247,11 +249,13 @@ describe("process reactive coordinator", () => {
|
||||
"write:secret",
|
||||
"resize:100x40",
|
||||
"render:100x40",
|
||||
"close-input",
|
||||
"kill:SIGINT",
|
||||
]);
|
||||
expect(harness.interactions.map(({ data }) => data)).toEqual([
|
||||
"<redacted-input:6-bytes>",
|
||||
"100x40",
|
||||
"",
|
||||
"SIGINT",
|
||||
]);
|
||||
expect(harness.checkpoints).toHaveLength(1);
|
||||
@@ -261,6 +265,7 @@ describe("process reactive coordinator", () => {
|
||||
"obs.interaction_events.0",
|
||||
"obs.interaction_events.1",
|
||||
"obs.interaction_events.2",
|
||||
"obs.interaction_events.3",
|
||||
"obs.filesystem_checkpoints.0",
|
||||
]);
|
||||
await harness.coordinator.close();
|
||||
|
||||
@@ -112,7 +112,9 @@ const succeededEffect = (action: ProcessReactiveAction, order: number) => ({
|
||||
? "input"
|
||||
: action.type === "resize"
|
||||
? "resize"
|
||||
: "signal",
|
||||
: action.type === "close_stdin"
|
||||
? "stdin_close"
|
||||
: "signal",
|
||||
data:
|
||||
action.type === "send_input"
|
||||
? action.sensitive
|
||||
@@ -120,7 +122,9 @@ const succeededEffect = (action: ProcessReactiveAction, order: number) => ({
|
||||
: action.data
|
||||
: action.type === "resize"
|
||||
? `${String(action.columns)}x${String(action.rows)}`
|
||||
: action.signal,
|
||||
: action.type === "close_stdin"
|
||||
? ""
|
||||
: action.signal,
|
||||
outcome: "dispatched",
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user