MCPcopy Create free account
hub / github.com/anus-dev/ANUS / run

Function run

packages/cli/src/ui/utils/commandUtils.ts:33–51  ·  view source on GitHub ↗
(cmd: string, args: string[])

Source from the content-addressed store, hash-verified

31// Copies a string snippet to the clipboard for different platforms
32export const copyToClipboard = async (text: string): Promise<void> => {
33 const run = (cmd: string, args: string[]) =>
34 new Promise<void>((resolve, reject) => {
35 const child = spawn(cmd, args);
36 let stderr = '';
37 child.stderr.on('data', (chunk) => (stderr += chunk.toString()));
38 child.on('error', reject);
39 child.on('close', (code) => {
40 if (code === 0) return resolve();
41 const errorMsg = stderr.trim();
42 reject(
43 new Error(
44 `'${cmd}' exited with code ${code}${errorMsg ? `: ${errorMsg}` : ''}`,
45 ),
46 );
47 });
48 child.stdin.on('error', reject);
49 child.stdin.write(text);
50 child.stdin.end();
51 });
52
53 switch (process.platform) {
54 case 'win32':

Callers 1

copyToClipboardFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected