runOn

tcmts.cli.sync.runOn · #kpeutf7c · term · runs on the server

uses process

import type { Codebase } from "#codebase/tcmts/cli/codebase";
import { dim } from "#codebase/tcmts/cli/style";
import { openRemote, sendClosure } from "#codebase/tcmts/cli/sync";

export async function runOn(cb: Codebase, spec: string, hash: string, args: string[]): Promise<number> {
  const { remote } = openRemote(cb, spec);
  const sent = await sendClosure(cb, remote, [hash]);
  if (sent) process.stderr.write(dim(`sent ${sent} definition(s) to ${remote.label}\n`));
  return remote.run(hash, args, (s, d) => (s === "stdout" ? process.stdout : process.stderr).write(d));
}

uses

used by