democut 1.0.62 → 1.0.63

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.
Files changed (2) hide show
  1. package/dist/cli.js +22 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -6916,7 +6916,7 @@ import { realpathSync } from "fs";
6916
6916
  import { fileURLToPath } from "url";
6917
6917
 
6918
6918
  // src/version.ts
6919
- var VERSION = "1.0.62";
6919
+ var VERSION = "1.0.63";
6920
6920
 
6921
6921
  // src/device-flow.ts
6922
6922
  var DeviceFlowError = class extends Error {
@@ -24885,15 +24885,34 @@ var invokedDirectly = (() => {
24885
24885
  return false;
24886
24886
  }
24887
24887
  })();
24888
+ var writtenOrReaderLeft = (e) => !e || e.code === "EPIPE";
24889
+ function flushed(stream) {
24890
+ return new Promise((resolve2) => {
24891
+ if (stream.errored) return resolve2(writtenOrReaderLeft(stream.errored));
24892
+ if (stream.destroyed || !stream.writable) return resolve2(true);
24893
+ stream.once("error", (e) => resolve2(writtenOrReaderLeft(e)));
24894
+ stream.write("", (e) => resolve2(writtenOrReaderLeft(e)));
24895
+ });
24896
+ }
24897
+ function exitCodeAfterFlush(code, stdoutComplete) {
24898
+ return !stdoutComplete && code === EXIT.OK ? EXIT.GENERAL : code;
24899
+ }
24900
+ async function exitAfterFlush(code) {
24901
+ const [stdoutComplete] = await Promise.all([flushed(process.stdout), flushed(process.stderr)]);
24902
+ if (!stdoutComplete) process.stderr.write("\uC624\uB958: \uCD9C\uB825\uC744 \uB05D\uAE4C\uC9C0 \uC4F0\uC9C0 \uBABB\uD588\uC5B4\uC694(\uB514\uC2A4\uD06C\xB7\uC785\uCD9C\uB825 \uC624\uB958). \uACB0\uACFC\uAC00 \uC798\uB838\uC744 \uC218 \uC788\uC5B4\uC694.\n");
24903
+ process.exit(exitCodeAfterFlush(code, stdoutComplete));
24904
+ }
24888
24905
  if (invokedDirectly || process.env.DEMOCUT_CLI_RUN === "1") {
24889
- run(process.argv.slice(2)).then((code) => process.exit(code)).catch((e) => {
24906
+ run(process.argv.slice(2)).then((code) => exitAfterFlush(code)).catch((e) => {
24890
24907
  process.stderr.write(`\uC624\uB958: ${e?.message ?? String(e)}
24891
24908
  `);
24892
- process.exit(1);
24909
+ return exitAfterFlush(1);
24893
24910
  });
24894
24911
  }
24895
24912
  export {
24896
24913
  VERSION,
24914
+ exitCodeAfterFlush,
24915
+ flushed,
24897
24916
  parseArgs,
24898
24917
  run
24899
24918
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "democut",
3
- "version": "1.0.62",
3
+ "version": "1.0.63",
4
4
  "description": "DemoCut 에이전트 CLI — device flow 로그인(RFC 8628) + 영상 생성",
5
5
  "license": "MIT",
6
6
  "author": "InfoGrab",