spamscanner 7.0.5 → 7.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/cli.js +29 -10
- package/dist/esm/cli.js.map +3 -3
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/cli.js
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
statSync as statSync2
|
|
14
14
|
} from "node:fs";
|
|
15
15
|
import process3 from "node:process";
|
|
16
|
-
import { pipeline } from "node:stream";
|
|
17
16
|
import { format, parseArgs } from "node:util";
|
|
18
17
|
|
|
19
18
|
// src/classifier.js
|
|
@@ -5946,7 +5945,7 @@ import net from "node:net";
|
|
|
5946
5945
|
var package_default = {
|
|
5947
5946
|
name: "spamscanner",
|
|
5948
5947
|
description: "Spam, phishing and malware filter for email in any language: a trainable classifier, link and attachment checks, SPF/DKIM/DMARC, and an optional AI second opinion from any LLM, including local Ollama models. Works as a library, CLI, Postfix milter or HTTP API.",
|
|
5949
|
-
version: "7.0.
|
|
5948
|
+
version: "7.0.6",
|
|
5950
5949
|
author: "Forward Email (https://forwardemail.net)",
|
|
5951
5950
|
bin: {
|
|
5952
5951
|
spamscanner: "./dist/esm/cli.js"
|
|
@@ -9645,24 +9644,44 @@ function listen(server, values, defaultPort, io) {
|
|
|
9645
9644
|
function deliver(sendmail, args, message, rest) {
|
|
9646
9645
|
return new Promise((resolve, reject) => {
|
|
9647
9646
|
const child = spawn(sendmail, args, { stdio: ["pipe", "ignore", "inherit"] });
|
|
9647
|
+
let written = Promise.resolve(true);
|
|
9648
9648
|
child.on("error", reject);
|
|
9649
|
-
child.on("close", (code) =>
|
|
9649
|
+
child.on("close", async (code) => {
|
|
9650
|
+
resolve(await written ? code ?? "a signal" : "a signal");
|
|
9651
|
+
});
|
|
9650
9652
|
child.stdin.on("error", () => {
|
|
9651
9653
|
});
|
|
9652
9654
|
if (!rest) {
|
|
9653
9655
|
child.stdin.end(message);
|
|
9654
9656
|
return;
|
|
9655
9657
|
}
|
|
9656
|
-
|
|
9657
|
-
|
|
9658
|
-
|
|
9659
|
-
|
|
9660
|
-
|
|
9661
|
-
|
|
9658
|
+
written = (async () => {
|
|
9659
|
+
try {
|
|
9660
|
+
for await (const chunk2 of prepend(message, rest)) {
|
|
9661
|
+
await new Promise((resolve2, reject2) => {
|
|
9662
|
+
child.stdin.write(chunk2, (error) => {
|
|
9663
|
+
if (error) {
|
|
9664
|
+
reject2(error);
|
|
9665
|
+
} else {
|
|
9666
|
+
resolve2();
|
|
9667
|
+
}
|
|
9668
|
+
});
|
|
9669
|
+
});
|
|
9670
|
+
}
|
|
9671
|
+
child.stdin.end();
|
|
9672
|
+
return true;
|
|
9673
|
+
} catch {
|
|
9674
|
+
child.kill("SIGKILL");
|
|
9675
|
+
child.stdin.destroy();
|
|
9676
|
+
return false;
|
|
9662
9677
|
}
|
|
9663
|
-
});
|
|
9678
|
+
})();
|
|
9664
9679
|
});
|
|
9665
9680
|
}
|
|
9681
|
+
async function* prepend(first, rest) {
|
|
9682
|
+
yield first;
|
|
9683
|
+
yield* rest;
|
|
9684
|
+
}
|
|
9666
9685
|
async function deliverOrDefer({ sendmail, args, message, rest }, stderr) {
|
|
9667
9686
|
const code = await deliver(sendmail, args, message, rest);
|
|
9668
9687
|
if (code !== 0) {
|