@hugoalh/adler32 0.6.2 → 0.6.3
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/cli.js +8 -15
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -52,27 +52,20 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
|
|
|
52
52
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
53
53
|
});
|
|
54
54
|
import { constants as fsConstants, open as openFile } from "node:fs/promises";
|
|
55
|
-
import
|
|
55
|
+
import process from "node:process";
|
|
56
56
|
import { parseArgs, styleText } from "node:util";
|
|
57
57
|
import { Adler32 } from "./mod.js";
|
|
58
58
|
if (!import.meta.main) {
|
|
59
59
|
throw new Error(`This entrypoint is for command line only!`);
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
message = event.reason.message;
|
|
66
|
-
if ((event.reason.stack ?? "").length > 0) {
|
|
67
|
-
message += `\n${event.reason.stack}`;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
message = String(event.reason);
|
|
61
|
+
process.addListener("uncaughtException", (error) => {
|
|
62
|
+
let message = error.message;
|
|
63
|
+
if ((error.stack ?? "").length > 0) {
|
|
64
|
+
message += `\n${error.stack}`;
|
|
72
65
|
}
|
|
73
66
|
console.error(`${styleText(["red"], "ERROR", { validateStream: false })}\t${message}`);
|
|
74
|
-
exit(1);
|
|
75
|
-
}
|
|
67
|
+
process.exit(1);
|
|
68
|
+
});
|
|
76
69
|
const { positionals, values: { file: fromFile = false, stdin: fromStdin = false } } = parseArgs({
|
|
77
70
|
allowPositionals: true,
|
|
78
71
|
options: {
|
|
@@ -109,7 +102,7 @@ if (fromFile) {
|
|
|
109
102
|
}
|
|
110
103
|
}
|
|
111
104
|
else if (fromStdin) {
|
|
112
|
-
await instance.updateFromStream(stdin);
|
|
105
|
+
await instance.updateFromStream(process.stdin);
|
|
113
106
|
}
|
|
114
107
|
else {
|
|
115
108
|
instance.update(positionals[0]);
|