Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

Stop macOS capture helper when parent closes its input

webadderall0979839feebb
diff --git a/electron/native/ScreenCaptureKitRecorder.swift b/electron/native/ScreenCaptureKitRecorder.swift
index 6e4b0efd..d47e1605 100644
--- a/electron/native/ScreenCaptureKitRecorder.swift
+++ b/electron/native/ScreenCaptureKitRecorder.swift
@@ -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() {
diff --git a/electron/native/ScreenCaptureKitRecorder.test.ts b/electron/native/ScreenCaptureKitRecorder.test.ts
index 54ae01b5..bf787842 100644
--- a/electron/native/ScreenCaptureKitRecorder.test.ts
+++ b/electron/native/ScreenCaptureKitRecorder.test.ts
@@ -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()");
diff --git a/electron/native/bin/darwin-arm64/recordly-screencapturekit-helper b/electron/native/bin/darwin-arm64/recordly-screencapturekit-helper
index 5a89a2a4..54b450ce 100755
Binary files a/electron/native/bin/darwin-arm64/recordly-screencapturekit-helper and b/electron/native/bin/darwin-arm64/recordly-screencapturekit-helper differ
diff --git a/electron/native/bin/darwin-x64/recordly-screencapturekit-helper b/electron/native/bin/darwin-x64/recordly-screencapturekit-helper
index ed9450cc..0bd08966 100755
Binary files a/electron/native/bin/darwin-x64/recordly-screencapturekit-helper and b/electron/native/bin/darwin-x64/recordly-screencapturekit-helper differ