INNER CODE UNIT · TypeScript

prepareOutput

pranshuchittora/simvyn · extensions/simvyn/index.ts:50

async function prepareOutput(cwd: string, requested: string | undefined, fallback: string) {
	const path = requested ? resolve(cwd, requested.replace(/^@/, "")) : fallback;
	await mkdir(dirname(path), { recursive: true });
	return path;
}

function failure(args: string[], result: RunResult) {
	let status = `exited with ${result.code ?? result.signal}`;
	if (result.timedOut) status = "timed out";
	else if (!result.started) status = "did not start";
	else if (result.code === 0 && !result.stopped) status = "ended before the requested duration";
	const output = truncateTail(result.output.trim(), { maxLines: 40, maxBytes: 8192 }).content;
	return new Error(`simvyn ${args.join(" ")} ${status}${output ? `\n${output}` : ""}`);
}

export default function simvyn(pi: ExtensionAPI) {
	let ui: ExtensionContext["ui"] | undefined;
	const refreshStatus = () => {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…