]> git.codecow.com Git - libnemo.git/commitdiff
Adjust worker returns.
authorChris Duncan <chris@codecow.com>
Sun, 9 Aug 2026 06:21:32 +0000 (23:21 -0700)
committerChris Duncan <chris@codecow.com>
Sun, 9 Aug 2026 06:21:32 +0000 (23:21 -0700)
src/lib/vault/vault-worker.ts

index 9043abf4a48654da3e944b2d865be8afaa9cd4d6..d507b1ee8b26f26fd616bea28615bae106419eeb 100644 (file)
@@ -34,7 +34,7 @@ const listener = (event: MessageEvent<any>): void => {
        if (typeof taskId !== 'string') return
        BROWSER: if (taskUrl !== location.href) return
        NODE: if (taskUrl !== dec.toString(threadId)) return
-       NODE: if (parentPort == null) setTimeout(() => listener(event), 0)
+       NODE: if (parentPort == null) return void setTimeout(() => listener(event), 0)
        const action = parseAction(data)
        const keySalt = parseKeySalt(action, data)
        const type = parseType(action, data)
@@ -46,9 +46,7 @@ const listener = (event: MessageEvent<any>): void => {
                .then((key: CryptoKey | undefined): Promise<Record<string, boolean | number | ArrayBuffer> | void> => {
                        switch (action) {
                                case 'STOP': {
-                                       BROWSER: close()
-                                       NODE: process.exit()
-                                       break
+                                       return process?.exit?.() ?? close()
                                }
                                case 'config': {
                                        return config(timeout)