mirror of
https://github.com/langchain-ai/langgraphjs-api.git
synced 2026-07-19 21:33:46 -04:00
fix(cli): gracefulExit not called when failing to parse arg
This commit is contained in:
@@ -13,7 +13,7 @@ import * as path from "node:path";
|
||||
import * as fs from "node:fs/promises";
|
||||
import { logger } from "../utils/logging.mjs";
|
||||
import { withAnalytics } from "./utils/analytics.mjs";
|
||||
|
||||
import { gracefulExit } from "exit-hook";
|
||||
const stream = <T extends { spawnargs: string[] }>(proc: T): T => {
|
||||
logger.info(`Running "${proc.spawnargs.join(" ")}"`);
|
||||
return proc;
|
||||
@@ -30,6 +30,7 @@ builder
|
||||
)
|
||||
.argument("[args...]")
|
||||
.passThroughOptions()
|
||||
.exitOverride((error) => gracefulExit(error.exitCode))
|
||||
.hook(
|
||||
"preAction",
|
||||
withAnalytics((command) => ({
|
||||
|
||||
@@ -13,6 +13,7 @@ import { getConfig } from "../utils/config.mjs";
|
||||
import { builder } from "./utils/builder.mjs";
|
||||
import { logError, logger } from "../utils/logging.mjs";
|
||||
import { withAnalytics } from "./utils/analytics.mjs";
|
||||
import { gracefulExit } from "exit-hook";
|
||||
|
||||
builder
|
||||
.command("dev")
|
||||
@@ -26,6 +27,7 @@ builder
|
||||
.option("-c, --config <path>", "path to configuration file", process.cwd())
|
||||
.allowExcessArguments()
|
||||
.allowUnknownOption()
|
||||
.exitOverride((error) => gracefulExit(error.exitCode))
|
||||
.hook(
|
||||
"preAction",
|
||||
withAnalytics((command) => ({
|
||||
|
||||
@@ -12,6 +12,7 @@ import * as path from "node:path";
|
||||
import dedent from "dedent";
|
||||
import { logger } from "../utils/logging.mjs";
|
||||
import { withAnalytics } from "./utils/analytics.mjs";
|
||||
import { gracefulExit } from "exit-hook";
|
||||
|
||||
const fileExists = async (path: string) => {
|
||||
try {
|
||||
@@ -33,6 +34,7 @@ builder
|
||||
"Add additional files for running the LangGraph API server with docker-compose. These files include a docker-compose.yml, .env file, and a .dockerignore file.",
|
||||
)
|
||||
.option("-c, --config <path>", "Path to configuration file", process.cwd())
|
||||
.exitOverride((error) => gracefulExit(error.exitCode))
|
||||
.hook(
|
||||
"preAction",
|
||||
withAnalytics((command) => ({
|
||||
|
||||
@@ -11,6 +11,7 @@ import { $ } from "execa";
|
||||
import { createHash } from "node:crypto";
|
||||
import dedent from "dedent";
|
||||
import { withAnalytics } from "./utils/analytics.mjs";
|
||||
import { gracefulExit } from "exit-hook";
|
||||
|
||||
const sha256 = (input: string) =>
|
||||
createHash("sha256").update(input).digest("hex");
|
||||
@@ -64,6 +65,7 @@ builder
|
||||
"--postgres-uri <uri>",
|
||||
"Postgres URI to use for the database. Defaults to launching a local database",
|
||||
)
|
||||
.exitOverride((error) => gracefulExit(error.exitCode))
|
||||
.hook(
|
||||
"preAction",
|
||||
withAnalytics((command) => ({
|
||||
|
||||
Reference in New Issue
Block a user