MCPcopy
hub / github.com/winglang/wing / runWingCommand

Function runWingCommand

tools/hangar/src/utils.ts:16–53  ·  view source on GitHub ↗
(options: RunWingCommandOptions)

Source from the content-addressed store, hash-verified

14}
15
16export async function runWingCommand(options: RunWingCommandOptions) {
17 const platformOptions: string[] = [];
18 options.platforms?.forEach((p) => platformOptions.push(...["-t", `${p}`])) ??
19 [];
20 const out = await execa(
21 wingBin,
22 [
23 "--no-update-check",
24 "--no-analytics",
25 ...options.args,
26 options.wingFile ?? "",
27 ...platformOptions,
28 ],
29 {
30 cwd: options.cwd,
31 reject: false,
32 stdin: "ignore",
33 env: options.env,
34 }
35 );
36
37 const output = [out.stdout, out.stderr].join("\n");
38
39 if (options.expectFailure) {
40 if (out.exitCode == 0) {
41 expect.fail(output);
42 }
43 } else {
44 if (out.exitCode != 0) {
45 expect.fail(output);
46 }
47 }
48
49 return {
50 stderr: sanitizeOutput(out.stderr),
51 stdout: sanitizeOutput(out.stdout),
52 };
53}
54
55export function sanitizeOutput(output: string) {
56 return (

Callers 12

tree_json.test.tsFile · 0.90
error.test.tsFile · 0.90
compileTestFunction · 0.90
testTestFunction · 0.90
esm.test.tsFile · 0.90
platform.test.tsFile · 0.90
invalid.test.tsFile · 0.90
testManifestCacheFunction · 0.90
cli.bench.tsFile · 0.90

Calls 4

failMethod · 0.80
sanitizeOutputFunction · 0.70
pushMethod · 0.65
joinMethod · 0.45

Tested by 1

testManifestCacheFunction · 0.72