MCPcopy
hub / github.com/angular/angularfire / spawnAsync

Function spawnAsync

src/schematics/deploy/actions.ts:28–55  ·  view source on GitHub ↗
(
  command: string,
  options?: SpawnOptionsWithoutStdio
)

Source from the content-addressed store, hash-verified

26};
27
28const spawnAsync = async (
29 command: string,
30 options?: SpawnOptionsWithoutStdio
31) =>
32 new Promise<Buffer>((resolve, reject) => {
33 const [spawnCommand, ...args] = command.split(/\s+/);
34 const spawnProcess = spawn(spawnCommand, args, options);
35 const chunks: Buffer[] = [];
36 const errorChunks: Buffer[] = [];
37 spawnProcess.stdout.on('data', (data) => {
38 process.stdout.write(data.toString());
39 chunks.push(data);
40 });
41 spawnProcess.stderr.on('data', (data) => {
42 process.stderr.write(data.toString());
43 errorChunks.push(data);
44 });
45 spawnProcess.on('error', (error) => {
46 reject(error);
47 });
48 spawnProcess.on('close', (code) => {
49 if (code === 1) {
50 reject(Buffer.concat(errorChunks).toString());
51 return;
52 }
53 resolve(Buffer.concat(chunks));
54 });
55 });
56
57export type DeployBuilderOptions = DeployBuilderSchema & Record<string, any>;
58

Callers 2

deployToCloudRunFunction · 0.85
deployFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected