Skip to content

armgit / hypit

Public Imported from GitHub
0

Clone any viral video with AI agents. Not just a script, the whole workflow: swap the face, the words, the B-roll, ship 100 variants in one command, and get your 100M views.

fix: a child process starts without opening a console window

rpone99e1bf2855bb
diff --git a/.agents/skills/hypit/scripts/check-environment.mjs b/.agents/skills/hypit/scripts/check-environment.mjs
index 014ef458..687a9da3 100755
--- a/.agents/skills/hypit/scripts/check-environment.mjs
+++ b/.agents/skills/hypit/scripts/check-environment.mjs
@@ -11,7 +11,7 @@ const commands = [
];
for (const [command, versionFlag] of commands) {
try {
- const version = execFileSync(command, [versionFlag], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim().split(/\r?\n/, 1)[0];
+ const version = execFileSync(command, [versionFlag], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], windowsHide: true }).trim().split(/\r?\n/, 1)[0];
console.log(`${command}\tok\t${version}`);
} catch { console.log(`${command}\tmissing`); }
}
diff --git a/examples/street-interview-preview/align-transcript.ts b/examples/street-interview-preview/align-transcript.ts
index cba2f0ae..c16ee76d 100644
--- a/examples/street-interview-preview/align-transcript.ts
+++ b/examples/street-interview-preview/align-transcript.ts
@@ -47,7 +47,7 @@ function sceneDuration(file: string): number {
const raw = execFileSync("ffprobe", [
"-v", "error", "-show_entries", "format=duration", "-of", "csv=p=0",
join(repoRoot, "docs/public/street-interview", file),
- ], { encoding: "utf8" });
+ ], { encoding: "utf8", windowsHide: true });
return Number(raw.trim());
}
diff --git a/packages/credential-store-keychain/src/store.ts b/packages/credential-store-keychain/src/store.ts
index d1b76934..b2926e07 100644
--- a/packages/credential-store-keychain/src/store.ts
+++ b/packages/credential-store-keychain/src/store.ts
@@ -39,7 +39,7 @@ function macosSecurity(service: string): KeychainReader {
return async (_service, account) => await new Promise((resolve, reject) => {
execFile("/usr/bin/security",
["find-generic-password", "-s", service, "-a", account, "-w"],
- { timeout: 10_000, shell: false },
+ { timeout: 10_000, shell: false, windowsHide: true },
(error, stdout) => {
if (error === null) {
resolve(stdout.replace(/\n$/u, ""));
@@ -56,7 +56,7 @@ function macosWriter(service: string): KeychainWriter {
return async (_service, account, secret) => await new Promise((resolve, reject) => {
execFile("/usr/bin/security",
["add-generic-password", "-U", "-s", service, "-a", account, "-w", secret],
- { timeout: 10_000, shell: false },
+ { timeout: 10_000, shell: false, windowsHide: true },
(error) => error === null ? resolve() : reject(new Error(`keychain write for ${account} failed`)));
});
}
@@ -65,7 +65,7 @@ function macosDeleter(service: string): KeychainDeleter {
return async (_service, account) => await new Promise((resolve, reject) => {
execFile("/usr/bin/security",
["delete-generic-password", "-s", service, "-a", account],
- { timeout: 10_000, shell: false },
+ { timeout: 10_000, shell: false, windowsHide: true },
(error) => {
if (error === null) resolve(true);
else if ((error as { code?: number }).code === 44) resolve(false);
diff --git a/packages/hyperframes/test/browser-visual.test.ts b/packages/hyperframes/test/browser-visual.test.ts
index 63e189fd..48a5b4ae 100644
--- a/packages/hyperframes/test/browser-visual.test.ts
+++ b/packages/hyperframes/test/browser-visual.test.ts
@@ -163,7 +163,7 @@ async function collectPngs(directory: string): Promise<string[]> {
function yellowPixelsByColumns(file: string, width: number, height: number, columns: number): number[] {
const decoded = spawnSync("ffmpeg", [
"-v", "error", "-i", file, "-f", "rawvideo", "-pix_fmt", "rgba", "pipe:1",
- ], { encoding: "buffer", timeout: 30_000, maxBuffer: Math.max(16 * 1024 * 1024, width * height * 4 + 1024) });
+ ], { windowsHide: true, encoding: "buffer", timeout: 30_000, maxBuffer: Math.max(16 * 1024 * 1024, width * height * 4 + 1024) });
assert.equal(decoded.status, 0, decoded.stderr.toString());
assert.equal(decoded.stdout.byteLength, width * height * 4);
const counts = Array.from({ length: columns }, () => 0);
@@ -181,7 +181,7 @@ function yellowPixelsByColumns(file: string, width: number, height: number, colu
function decodedRgba(file: string, width: number, height: number): Buffer {
const decoded = spawnSync("ffmpeg", [
"-v", "error", "-i", file, "-f", "rawvideo", "-pix_fmt", "rgba", "pipe:1",
- ], { encoding: "buffer", timeout: 30_000, maxBuffer: Math.max(16 * 1024 * 1024, width * height * 4 + 1024) });
+ ], { windowsHide: true, encoding: "buffer", timeout: 30_000, maxBuffer: Math.max(16 * 1024 * 1024, width * height * 4 + 1024) });
assert.equal(decoded.status, 0, decoded.stderr.toString());
assert.equal(decoded.stdout.byteLength, width * height * 4);
return decoded.stdout;
@@ -389,7 +389,7 @@ test("locked font and straight-alpha Surface survive one real Hyperframes browse
"--no-browser-gpu",
"--no-best-effort",
"--quiet",
- ], { encoding: "utf8", timeout: 110_000 });
+ ], { windowsHide: true, encoding: "utf8", timeout: 110_000 });
assert.equal(render.status, 0, `${render.stdout}\n${render.stderr}`);
const renderedFrame = await findPng(output);
assert(renderedFrame !== undefined, "Hyperframes did not emit a PNG frame.");
@@ -399,7 +399,7 @@ test("locked font and straight-alpha Surface survive one real Hyperframes browse
"-f", "rawvideo",
"-pix_fmt", "rgba",
"pipe:1",
- ], { encoding: "buffer", timeout: 30_000 });
+ ], { windowsHide: true, encoding: "buffer", timeout: 30_000 });
assert.equal(decoded.status, 0, decoded.stderr.toString());
assert.equal(decoded.stdout.byteLength, 64 * 64 * 4);
const center = (32 * 64 + 32) * 4;
@@ -498,7 +498,7 @@ test("Fine Caption exact font, wrapping and all karaoke modes survive real brows
hyperframesCli, "render", temp,
"--format", "png-sequence", "--output", output, "--fps", "10", "--workers", "1",
"--no-browser-gpu", "--no-best-effort", "--quiet",
- ], { encoding: "utf8", timeout: 110_000 });
+ ], { windowsHide: true, encoding: "utf8", timeout: 110_000 });
assert.equal(render.status, 0, `${render.stdout}\n${render.stderr}`);
const frames = await collectPngs(output);
assert.equal(frames.length, 40);
@@ -578,7 +578,7 @@ test("Fine Caption joined trail Pill follows real wrapped browser line fragments
hyperframesCli, "render", temp,
"--format", "png-sequence", "--output", output, "--fps", "10", "--workers", "1",
"--no-browser-gpu", "--no-best-effort", "--quiet",
- ], { encoding: "utf8", timeout: 110_000 });
+ ], { windowsHide: true, encoding: "utf8", timeout: 110_000 });
assert.equal(render.status, 0, `${render.stdout}\n${render.stderr}`);
const frames = await collectPngs(output);
assert.equal(frames.length, 60);
@@ -685,7 +685,7 @@ test("installed open fonts render CJK, emoji and independent stroke, shadow and
hyperframesCli, "render", temp,
"--format", "png-sequence", "--output", output, "--fps", "30", "--workers", "1",
"--no-browser-gpu", "--no-best-effort", "--quiet",
- ], { encoding: "utf8", timeout: 110_000 });
+ ], { windowsHide: true, encoding: "utf8", timeout: 110_000 });
assert.equal(render.status, 0, `${render.stdout}\n${render.stderr}`);
const frames = await collectPngs(output);
assert.equal(frames.length, 1);
@@ -921,7 +921,7 @@ test("complete Text flow, Path, local mask and motion stay exact under parallel
hyperframesCli, "render", temp,
"--format", "png-sequence", "--output", output, "--fps", String(fps), "--workers", String(workers),
"--no-browser-gpu", "--no-best-effort", "--quiet",
- ], { encoding: "utf8", timeout: 170_000 });
+ ], { windowsHide: true, encoding: "utf8", timeout: 170_000 });
assert.equal(result.status, 0, `${result.stdout}\n${result.stderr}`);
return await collectPngs(output);
};
@@ -1126,7 +1126,7 @@ test("Text box targets, rich runs and every sequence direction remain stable acr
hyperframesCli, "render", temp,
"--format", "png-sequence", "--output", output, "--fps", String(fps), "--workers", String(workers),
"--no-browser-gpu", "--no-best-effort", "--quiet",
- ], { encoding: "utf8", timeout: 170_000 });
+ ], { windowsHide: true, encoding: "utf8", timeout: 170_000 });
assert.equal(result.status, 0, `${result.stdout}\n${result.stderr}`);
return collectPngs(output);
};
@@ -1235,7 +1235,7 @@ test("vertical Text paints in its authored direction and bounded shrink fails cl
hyperframesCli, "render", temp,
"--format", "png-sequence", "--output", verticalOutput, "--fps", String(fps), "--workers", "1",
"--no-browser-gpu", "--no-best-effort", "--quiet",
- ], { encoding: "utf8", timeout: 100_000 });
+ ], { windowsHide: true, encoding: "utf8", timeout: 100_000 });
assert.equal(verticalResult.status, 0, `${verticalResult.stdout}\n${verticalResult.stderr}`);
const verticalFrames = await collectPngs(verticalOutput);
assert.equal(verticalFrames.length, 1);
@@ -1255,7 +1255,7 @@ test("vertical Text paints in its authored direction and bounded shrink fails cl
hyperframesCli, "render", temp,
"--format", "png-sequence", "--output", shrinkOutput, "--fps", String(fps), "--workers", "1",
"--no-browser-gpu", "--no-best-effort", "--quiet",
- ], { encoding: "utf8", timeout: 100_000 });
+ ], { windowsHide: true, encoding: "utf8", timeout: 100_000 });
assert.notEqual(shrinkResult.status, 0, "bounded Text shrink silently rendered below its authored minimum");
assert.match(`${shrinkResult.stdout}\n${shrinkResult.stderr}`, /Text cannot fit at its authored minimum scale/u);
} finally {
@@ -1377,7 +1377,7 @@ test("Media two-frame sampling, alpha, local motion and handoff survive partitio
hyperframesCli, "render", temp,
"--format", "png-sequence", "--output", output, "--fps", "12", "--workers", String(workers),
"--no-browser-gpu", "--no-best-effort", "--quiet",
- ], { encoding: "utf8", timeout: 110_000 });
+ ], { windowsHide: true, encoding: "utf8", timeout: 110_000 });
assert.equal(result.status, 0, `${result.stdout}\n${result.stderr}`);
return Promise.all((await collectPngs(output)).map(async (file) => decodedRgba(file, width, height)));
};
@@ -1552,7 +1552,7 @@ test("DepthStack Deck reflow, exact labels and old-system layout survive partiti
hyperframesCli, "render", temp,
"--format", "png-sequence", "--output", output, "--fps", String(fps), "--workers", String(workers),
"--no-browser-gpu", "--no-best-effort", "--quiet",
- ], { encoding: "utf8", timeout: 110_000 });
+ ], { windowsHide: true, encoding: "utf8", timeout: 110_000 });
assert.equal(result.status, 0, `${result.stdout}\n${result.stderr}`);
return Promise.all((await collectPngs(output)).map(async (file) => decodedRgba(file, width, height)));
};
@@ -1713,7 +1713,7 @@ test("all three Ranking components paint frame-pure progressive states under par
hyperframesCli, "render", temp,
"--format", "png-sequence", "--output", output, "--fps", String(fps), "--workers", String(workers),
"--no-browser-gpu", "--no-best-effort", "--quiet",
- ], { encoding: "utf8", timeout: 110_000 });
+ ], { windowsHide: true, encoding: "utf8", timeout: 110_000 });
assert.equal(result.status, 0, `${result.stdout}\n${result.stderr}`);
return Promise.all((await collectPngs(output)).map(async (file) => decodedRgba(file, width, height)));
};
@@ -1886,7 +1886,7 @@ test("all Spatial fit modes and equal-point alignments reach exact browser pixel
hyperframesCli, "render", temp,
"--format", "png-sequence", "--output", output, "--fps", "1", "--workers", "1",
"--no-browser-gpu", "--no-best-effort", "--quiet",
- ], { encoding: "utf8", timeout: 110_000 });
+ ], { windowsHide: true, encoding: "utf8", timeout: 110_000 });
assert.equal(result.status, 0, `${result.stdout}\n${result.stderr}`);
const files = await collectPngs(output);
assert.equal(files.length, 1);
@@ -2009,7 +2009,7 @@ test("every official Screen Overlay survives real sequential and parallel browse
hyperframesCli, "render", temp,
"--format", "png-sequence", "--output", output, "--fps", "12", "--workers", String(workers),
"--no-browser-gpu", "--no-best-effort", "--quiet",
- ], { encoding: "utf8", timeout: 110_000 });
+ ], { windowsHide: true, encoding: "utf8", timeout: 110_000 });
assert.equal(result.status, 0, `${result.stdout}\n${result.stderr}`);
return collectPngs(output);
};
diff --git a/packages/media-execution/src/execute.ts b/packages/media-execution/src/execute.ts
index dce81690..41ca81ab 100644
--- a/packages/media-execution/src/execute.ts
+++ b/packages/media-execution/src/execute.ts
@@ -93,6 +93,7 @@ async function runProcess(args: {
return await new Promise((resolve, reject) => {
const child = spawn(args.executable, [...args.argv], {
shell: false,
+ windowsHide: true,
stdio: ["ignore", "pipe", "pipe"],
env: {
PATH: process.env.PATH ?? "",
diff --git a/packages/media-execution/src/surface.ts b/packages/media-execution/src/surface.ts
index 51a8039b..bca9e9aa 100644
--- a/packages/media-execution/src/surface.ts
+++ b/packages/media-execution/src/surface.ts
@@ -53,6 +53,7 @@ async function runProcess(args: {
return await new Promise((resolve, reject) => {
const child = spawn(args.executable, [...args.argv], {
shell: false,
+ windowsHide: true,
stdio: ["ignore", "pipe", "pipe"],
env: { PATH: process.env.PATH ?? "" },
});
diff --git a/packages/media-execution/src/toolchain.ts b/packages/media-execution/src/toolchain.ts
index 70ab11ef..f2ceea2d 100644
--- a/packages/media-execution/src/toolchain.ts
+++ b/packages/media-execution/src/toolchain.ts
@@ -12,6 +12,7 @@ function run(executable: string, args: readonly string[]): Promise<{ ok: boolean
execFile(executable, [...args], {
timeout: 15_000,
shell: false,
+ windowsHide: true,
maxBuffer: 4 * 1024 * 1024,
}, (error, stdout, stderr) => {
resolve(error === null
diff --git a/packages/media-execution/test/surface.test.ts b/packages/media-execution/test/surface.test.ts
index 9e08d21b..6164fde4 100644
--- a/packages/media-execution/test/surface.test.ts
+++ b/packages/media-execution/test/surface.test.ts
@@ -9,13 +9,14 @@ import test from "node:test";
import { verifyCompositableSurfaceBytes } from "@hypit/media-execution";
import type { CompositableSurfaceRef } from "@hypit/media";
-const hasMediaTools = spawnSync("ffmpeg", ["-version"], { stdio: "ignore" }).status === 0
- && spawnSync("ffprobe", ["-version"], { stdio: "ignore" }).status === 0;
+const hasMediaTools = spawnSync("ffmpeg", ["-version"], { stdio: "ignore", windowsHide: true }).status === 0
+ && spawnSync("ffprobe", ["-version"], { stdio: "ignore", windowsHide: true }).status === 0;
async function ffmpeg(argv: readonly string[]): Promise<void> {
await new Promise<void>((resolve, reject) => {
const child = spawn("ffmpeg", ["-hide_banner", "-loglevel", "error", ...argv], {
shell: false,
+ windowsHide: true,
stdio: ["ignore", "ignore", "pipe"],
});
let stderr = "";
diff --git a/packages/provider-hyperframes-local/src/program.ts b/packages/provider-hyperframes-local/src/program.ts
index 2a3c3537..5168c9e6 100644
--- a/packages/provider-hyperframes-local/src/program.ts
+++ b/packages/provider-hyperframes-local/src/program.ts
@@ -9,7 +9,7 @@ import { defaultHyperframesCliPath } from "./provider.js";
function run(executable: string, args: readonly string[]): Promise<{ ok: boolean; output: string }> {
return new Promise((resolve) => {
- execFile(executable, [...args], { timeout: 15_000, shell: false }, (error, stdout, stderr) => {
+ execFile(executable, [...args], { timeout: 15_000, shell: false, windowsHide: true }, (error, stdout, stderr) => {
resolve(error === null
? { ok: true, output: stdout.trim() }
: { ok: false, output: (stderr.trim() || error.message).split("\n").at(-1) ?? "" });
diff --git a/packages/provider-hyperframes-local/src/provider.ts b/packages/provider-hyperframes-local/src/provider.ts
index a7c00be9..5c1662e3 100644
--- a/packages/provider-hyperframes-local/src/provider.ts
+++ b/packages/provider-hyperframes-local/src/provider.ts
@@ -91,6 +91,7 @@ async function runProcess(args: {
return await new Promise((resolve, reject) => {
const child = spawn(args.executable, [...args.argv], {
shell: false,
+ windowsHide: true,
stdio: ["ignore", "pipe", "pipe"],
env: processEnvironment(),
});
diff --git a/packages/provider-hyperframes-local/test/provider.test.ts b/packages/provider-hyperframes-local/test/provider.test.ts
index 32e79d40..f0e50160 100644
--- a/packages/provider-hyperframes-local/test/provider.test.ts
+++ b/packages/provider-hyperframes-local/test/provider.test.ts
@@ -17,7 +17,7 @@ import { createLocalHyperframesProvider } from "../src/index.js";
import { localHyperframesBrowserProgram } from "../src/program.js";
const liveEnabled = process.env.HYPIT_BROWSER_TESTS === "1";
-const hasFfprobe = spawnSync("ffprobe", ["-version"], { stdio: "ignore" }).status === 0;
+const hasFfprobe = spawnSync("ffprobe", ["-version"], { stdio: "ignore", windowsHide: true }).status === 0;
function documentFixture(surface?: CompositableSurfaceRef) {
const programSpace = sealProgramSpace({
diff --git a/packages/provider-image-opencv-local/src/program.ts b/packages/provider-image-opencv-local/src/program.ts
index 4f012f3b..d57b6e45 100644
--- a/packages/provider-image-opencv-local/src/program.ts
+++ b/packages/provider-image-opencv-local/src/program.ts
@@ -12,7 +12,7 @@ const PROBE_PROGRAM =
function run(executable: string, args: readonly string[]): Promise<{ ok: boolean; output: string }> {
return new Promise((resolve) => {
- execFile(executable, [...args], { timeout: 15_000, shell: false }, (error, stdout, stderr) => {
+ execFile(executable, [...args], { timeout: 15_000, shell: false, windowsHide: true }, (error, stdout, stderr) => {
resolve(error === null
? { ok: true, output: stdout.trim() }
: { ok: false, output: (stderr.trim() || error.message).split("\n").at(-1) ?? "" });
diff --git a/packages/provider-image-opencv-local/src/provider.ts b/packages/provider-image-opencv-local/src/provider.ts
index 486ae274..e3e1a306 100644
--- a/packages/provider-image-opencv-local/src/provider.ts
+++ b/packages/provider-image-opencv-local/src/provider.ts
@@ -55,7 +55,7 @@ async function runProcess(options: {
readonly maxStderrBytes: number;
}): Promise<void> {
await new Promise<void>((resolve, reject) => {
- const child = spawn(options.executable, [...options.args], { shell: false, stdio: ["ignore", "ignore", "pipe"] });
+ const child = spawn(options.executable, [...options.args], { shell: false, windowsHide: true, stdio: ["ignore", "ignore", "pipe"] });
let stderrBytes = 0;
const stderr: Buffer[] = [];
let failed: Error | undefined;
diff --git a/packages/provider-image-opencv-local/test/provider.test.ts b/packages/provider-image-opencv-local/test/provider.test.ts
index dd47d952..ebb4b438 100644
--- a/packages/provider-image-opencv-local/test/provider.test.ts
+++ b/packages/provider-image-opencv-local/test/provider.test.ts
@@ -88,7 +88,7 @@ test("managed and external OpenCV deployments never mix their interpreters", ()
const liveEnabled = process.env.HYPIT_OPENCV_TESTS === "1";
const openCvPython = process.env.HYPIT_OPENCV_PYTHON ?? "python3";
-const hasOpenCv = spawnSync(openCvPython, ["-c", "import cv2, numpy"], { stdio: "ignore" }).status === 0;
+const hasOpenCv = spawnSync(openCvPython, ["-c", "import cv2, numpy"], { stdio: "ignore", windowsHide: true }).status === 0;
test("the local Provider returns only a new image BlobArtifact", {
skip: !liveEnabled || !hasOpenCv,
@@ -158,7 +158,7 @@ test("the local Provider composes ordered Layers into exact Canvas pixels", {
"import cv2, numpy as np, sys",
"im=cv2.imdecode(np.frombuffer(sys.stdin.buffer.read(),np.uint8),cv2.IMREAD_UNCHANGED)",
"print(im.shape[1], im.shape[0], im.shape[2], ','.join(map(str,im[0,0])))",
- ].join(";")], { input: Buffer.from(output), encoding: "utf8" });
+ ].join(";")], { input: Buffer.from(output), encoding: "utf8", windowsHide: true });
assert.equal(probe.status, 0, probe.stderr);
assert.match(probe.stdout.trim(), /^3 2 4 \d+,\d+,\d+,\d+$/u);
});
diff --git a/packages/provider-media-local/test/provider.test.ts b/packages/provider-media-local/test/provider.test.ts
index 95e09e91..c5119ee5 100644
--- a/packages/provider-media-local/test/provider.test.ts
+++ b/packages/provider-media-local/test/provider.test.ts
@@ -27,8 +27,8 @@ import type { CapabilityRef, CanonicalValue, Need, TypeRef } from "@hypit/protoc
import { createLocalMediaProvider } from "../src/index.js";
import { localMediaToolchainProgram } from "../src/program.js";
-const hasMediaBinaries = spawnSync("ffmpeg", ["-version"], { stdio: "ignore" }).status === 0
- && spawnSync("ffprobe", ["-version"], { stdio: "ignore" }).status === 0;
+const hasMediaBinaries = spawnSync("ffmpeg", ["-version"], { stdio: "ignore", windowsHide: true }).status === 0
+ && spawnSync("ffprobe", ["-version"], { stdio: "ignore", windowsHide: true }).status === 0;
test("the local media Provider declares its external toolchain without owning a second daemon", async () => {
const program = localMediaToolchainProgram({ dataRoot: "/project", instance: "media", config: {} });
@@ -47,7 +47,7 @@ const animatedWebp = Buffer.from([
async function run(executable: string, args: readonly string[]): Promise<void> {
await new Promise<void>((resolve, reject) => {
- const child = spawn(executable, [...args], { stdio: ["ignore", "ignore", "pipe"] });
+ const child = spawn(executable, [...args], { stdio: ["ignore", "ignore", "pipe"], windowsHide: true });
let stderr = "";
child.stderr.on("data", (chunk: Buffer) => { stderr += chunk.toString(); });
child.on("error", reject);
@@ -272,6 +272,7 @@ test("local media Provider enumerates attached pictures and jointly normalizes 3
await new Promise<void>((resolve, reject) => {
const child = spawn("ffprobe", ["-v", "error", "-show_streams", "-of", "json", visualPath], {
stdio: ["ignore", "pipe", "pipe"],
+ windowsHide: true,
});
const chunks: Buffer[] = [];
let stderr = "";
diff --git a/packages/reference-video-tools/src/media.ts b/packages/reference-video-tools/src/media.ts
index d713867a..a25b5b0d 100644
--- a/packages/reference-video-tools/src/media.ts
+++ b/packages/reference-video-tools/src/media.ts
@@ -14,7 +14,7 @@ export async function ensureDir(path: string): Promise<void> { await mkdir(path,
export async function command(executable: string, args: readonly string[], timeoutMs = 120_000): Promise<Buffer> {
return await new Promise((resolvePromise, reject) => {
- const child = spawn(executable, [...args], { stdio: ["ignore", "pipe", "pipe"], shell: false });
+ const child = spawn(executable, [...args], { stdio: ["ignore", "pipe", "pipe"], shell: false, windowsHide: true });
const stdout: Buffer[] = [];
let stderr = "";
let settled = false;
diff --git a/packages/runtime-local/src/programs.ts b/packages/runtime-local/src/programs.ts
index 5d32f361..5474ef44 100644
--- a/packages/runtime-local/src/programs.ts
+++ b/packages/runtime-local/src/programs.ts
@@ -113,7 +113,7 @@ function signal(pid: number, name: NodeJS.Signals): "sent" | "gone" | "denied" {
function run(root: string, command: ManagedProgramCommand): Promise<{ ok: boolean; detail: string }> {
return new Promise((resolve) => {
- const child = spawn(command.command, [...command.args], { cwd: root, shell: false, stdio: ["ignore", "pipe", "pipe"] });
+ const child = spawn(command.command, [...command.args], { cwd: root, shell: false, windowsHide: true, stdio: ["ignore", "pipe", "pipe"] });
let output = "";
child.stdout.on("data", (chunk: Buffer) => { output += chunk.toString(); });
child.stderr.on("data", (chunk: Buffer) => { output += chunk.toString(); });
@@ -183,7 +183,14 @@ async function bringUp(
const child = spawn(program.start.command, [...program.start.args], {
cwd: root,
shell: false,
- detached: true,
+ // Outliving this process is the point, and each platform grants that differently. POSIX
+ // wants its own session. Windows already gives an unreferenced child its own lifetime, and
+ // asking to detach there costs the console: a detached process has none, so every console
+ // grandchild it starts is handed a fresh visible window instead. That is what a transcribing
+ // program looks like when `uv` re-execs Python and Python opens a pool of workers. Taking
+ // the hidden console instead leaves one console for the whole tree, and no window at all.
+ detached: process.platform !== "win32",
+ windowsHide: true,
stdio: ["ignore", log.fd, log.fd],
});
child.unref();
diff --git a/packages/runtime-local/src/worker-process.ts b/packages/runtime-local/src/worker-process.ts
index 720d9457..13adafbc 100644
--- a/packages/runtime-local/src/worker-process.ts
+++ b/packages/runtime-local/src/worker-process.ts
@@ -155,7 +155,10 @@ export async function ensureRuntimeProcess(
...(launch.workerArgs ?? []),
], {
cwd: process.cwd(),
- detached: true,
+ // See the managed program start in `programs.ts`: on Windows, detaching costs the console and
+ // every console descendant then gets a window of its own.
+ detached: process.platform !== "win32",
+ windowsHide: true,
stdio: ["ignore", log.fd, log.fd],
env: process.env,
});
diff --git a/packages/svml-playground/src/pipeline/placeholder.ts b/packages/svml-playground/src/pipeline/placeholder.ts
index e8a71d82..5d7a8935 100644
--- a/packages/svml-playground/src/pipeline/placeholder.ts
+++ b/packages/svml-playground/src/pipeline/placeholder.ts
@@ -42,7 +42,7 @@ export function heldPicture(
"-vf", `scale=${size.width}:${size.height}:force_original_aspect_ratio=increase,`
+ `crop=${size.width}:${size.height},setsar=1`,
"-shortest", "-c:v", "libx264", "-pix_fmt", "yuv420p", "-c:a", "aac", path,
- ], { timeout: 120_000 });
+ ], { timeout: 120_000, windowsHide: true });
return { bytes: readFileSync(path), mediaType: "video/mp4" };
} catch {
// Without ffmpeg there is no stand-in of any kind, which the caller already
@@ -76,7 +76,7 @@ export function blackFrames(
`color=c=black:s=${size.width}x${size.height}:r=${rate}:d=${Math.max(1, seconds)}`,
"-f", "lavfi", "-i", "anullsrc=channel_layout=stereo:sample_rate=48000",
"-shortest", "-c:v", "libx264", "-pix_fmt", "yuv420p", "-c:a", "aac", path,
- ], { timeout: 60_000 });
+ ], { timeout: 60_000, windowsHide: true });
cache.set(key, { bytes: readFileSync(path), mediaType: "video/mp4" });
} catch {
// No ffmpeg, so there is no stand-in either, and the Tracks that needed
diff --git a/services/media-lambda/build-layer.mjs b/services/media-lambda/build-layer.mjs
index c92249ec..a7b677ff 100755
--- a/services/media-lambda/build-layer.mjs
+++ b/services/media-lambda/build-layer.mjs
@@ -108,7 +108,7 @@ await rm(work, { recursive: true, force: true });
await rm(archive, { force: true });
await mkdir(extracted, { recursive: true });
await mkdir(layer, { recursive: true });
-await promisify(execFile)("tar", ["-xf", source, "-C", extracted]);
+await promisify(execFile)("tar", ["-xf", source, "-C", extracted], { windowsHide: true });
const roots = (await readdir(extracted)).sort();
if (roots.length !== 1) throw new Error(`FFmpeg archive must have one root directory; got ${roots.length}`);
@@ -160,7 +160,7 @@ for (const binary of [join(layer, "bin/ffmpeg"), join(layer, "bin/ffprobe")]) {
await promisify(execFile)("zip", [
"-X", "-q", "-y", archive,
...files.map((path) => relative(layer, path)),
-], { cwd: layer, env: { ...process.env, TZ: "UTC" } });
+], { cwd: layer, windowsHide: true, env: { ...process.env, TZ: "UTC" } });
let uncompressedBytes = 0;
for (const file of files) uncompressedBytes += (await lstat(file)).size;
diff --git a/services/media-lambda/build.mjs b/services/media-lambda/build.mjs
index 301c9fe4..b48fb3ad 100755
--- a/services/media-lambda/build.mjs
+++ b/services/media-lambda/build.mjs
@@ -61,6 +61,7 @@ await chmod(entry, 0o644);
const epoch = new Date("1980-01-01T00:00:00.000Z");
await utimes(entry, epoch, epoch);
await promisify(execFile)("zip", ["-X", "-q", "-j", archive, entry], {
+ windowsHide: true,
env: { ...process.env, TZ: "UTC" },
});
const archiveStat = await stat(archive);
diff --git a/services/media-lambda/src/handler.ts b/services/media-lambda/src/handler.ts
index 03d87da8..10089fca 100644
--- a/services/media-lambda/src/handler.ts
+++ b/services/media-lambda/src/handler.ts
@@ -127,6 +127,7 @@ async function assertBinaryVersion(
encoding: "utf8",
maxBuffer: 64 * 1024,
timeout: 10_000,
+ windowsHide: true,
env: {
...process.env,
...(sharedLibraryPath === undefined ? {} : { LD_LIBRARY_PATH: sharedLibraryPath }),