Fix Docker credential helper path for TTS

This commit is contained in:
2026-05-03 17:35:20 +09:00
parent 3abb6f81bb
commit b6284323be
2 changed files with 16 additions and 0 deletions

View File

@@ -9,11 +9,19 @@ import type { Logger } from "../logger.js";
import { playWavFile } from "./audio-playback.js"; import { playWavFile } from "./audio-playback.js";
async function run(command: string, args: string[], stdio: "ignore" | "inherit" = "ignore"): Promise<void> { async function run(command: string, args: string[], stdio: "ignore" | "inherit" = "ignore"): Promise<void> {
const env = { ...process.env };
if (path.isAbsolute(command)) {
const dockerBinDir = path.dirname(command);
const currentPath = env.PATH ?? env.Path ?? "";
env.PATH = `${dockerBinDir}${path.delimiter}${currentPath}`;
}
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
const child = spawn(command, args, { const child = spawn(command, args, {
stdio: ["ignore", stdio, "inherit"], stdio: ["ignore", stdio, "inherit"],
windowsHide: true, windowsHide: true,
shell: process.platform === "win32" && !path.isAbsolute(command), shell: process.platform === "win32" && !path.isAbsolute(command),
env,
}); });
child.on("error", (error) => { child.on("error", (error) => {

View File

@@ -9,12 +9,20 @@ import { Logger } from "./logger.js";
import { MeloTtsService } from "./services/melo-tts.js"; import { MeloTtsService } from "./services/melo-tts.js";
async function run(command: string, args: string[], cwd = process.cwd()): Promise<void> { async function run(command: string, args: string[], cwd = process.cwd()): Promise<void> {
const env = { ...process.env };
if (path.isAbsolute(command)) {
const dockerBinDir = path.dirname(command);
const currentPath = env.PATH ?? env.Path ?? "";
env.PATH = `${dockerBinDir}${path.delimiter}${currentPath}`;
}
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
const child = spawn(command, args, { const child = spawn(command, args, {
cwd, cwd,
stdio: "inherit", stdio: "inherit",
windowsHide: true, windowsHide: true,
shell: process.platform === "win32" && !path.isAbsolute(command), shell: process.platform === "win32" && !path.isAbsolute(command),
env,
}); });
child.on("error", (error) => { child.on("error", (error) => {