MCPcopy Index your code
hub / github.com/microsoft/vscode-cpptools / execChildProcess

Function execChildProcess

Extension/src/common.ts:724–763  ·  view source on GitHub ↗
(process: string, workingDirectory?: string, channel?: vscode.OutputChannel)

Source from the content-addressed store, hash-verified

722}
723
724export function execChildProcess(process: string, workingDirectory?: string, channel?: vscode.OutputChannel): Promise<string> {
725 return new Promise<string>((resolve, reject) => {
726 child_process.exec(process, { cwd: workingDirectory, maxBuffer: 500 * 1024 }, (error: Error | null, stdout: string, stderr: string) => {
727 if (channel) {
728 let message: string = "";
729 let err: boolean = false;
730 if (stdout && stdout.length > 0) {
731 message += stdout;
732 }
733
734 if (stderr && stderr.length > 0) {
735 message += stderr;
736 err = true;
737 }
738
739 if (error) {
740 message += error.message;
741 err = true;
742 }
743
744 if (err) {
745 channel.append(message);
746 channel.show();
747 }
748 }
749
750 if (error) {
751 reject(error);
752 return;
753 }
754
755 if (stderr && stderr.length > 0) {
756 reject(new Error(stderr));
757 return;
758 }
759
760 resolve(stdout);
761 });
762 });
763}
764
765export interface ProcessReturnType {
766 succeeded: boolean;

Callers 1

getMacAddressesFunction · 0.90

Calls 2

appendMethod · 0.65
showMethod · 0.45

Tested by

no test coverage detected