mirror of
https://github.com/webadderallorg/Recordly.git
synced 2026-09-24 14:55:37 +00:00
Stop macOS capture helper when parent closes its input
This commit is contained in:
@@ -1086,10 +1086,12 @@ DispatchQueue.global(qos: .utility).async {
|
||||
}
|
||||
|
||||
if input == "stop" {
|
||||
service.stop()
|
||||
break
|
||||
}
|
||||
}
|
||||
// EOF means the Electron parent exited or restarted. Finalize and release
|
||||
// capture devices just as we do for an explicit stop command.
|
||||
service.stop()
|
||||
}
|
||||
|
||||
if !service.waitUntilFinished() {
|
||||
|
||||
@@ -8,6 +8,16 @@ const recorderSource = readFileSync(
|
||||
);
|
||||
|
||||
describe("ScreenCaptureKitRecorder finalization coordination", () => {
|
||||
it("finalizes on parent pipe closure as well as an explicit stop, exactly once", () => {
|
||||
const commandLoop = recorderSource.slice(
|
||||
recorderSource.indexOf("while let input = readLine"),
|
||||
);
|
||||
expect(commandLoop).toMatch(
|
||||
/if input == "stop"\s*\{\s*break\s*\}\s*\}\s*\/\/.*?service\.stop\(\)/s,
|
||||
);
|
||||
expect(commandLoop.match(/service\.stop\(\)/g)).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("marks manual stops as participants in the shared finalization", () => {
|
||||
expect(recorderSource).toContain("finalizeCapture(interactive: true)");
|
||||
expect(recorderSource).toContain("finalization.outputResult.get()");
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user