private execCommand()

in src/manifestList.ts [454:492]


    private execCommand(
        command: string,
        manifest: WskDeployManifest,
        auth: AuthMetadata | null,
        deploymentFile: string | undefined,
        projectName?: string
    ): Promise<CommandExecResult> {
        return new Promise<CommandExecResult>((resolve, reject) => {
            const wskdeployPath = this.getWskdeployPath();
            const cwd = path.dirname(manifest.uri.fsPath);
            commandExists(wskdeployPath)
                .then(() => {
                    cp.exec(
                        this.getCommandWithAuth(
                            wskdeployPath,
                            command,
                            manifest,
                            auth,
                            deploymentFile,
                            projectName
                        ),
                        {
                            cwd,
                        },
                        (error, stdout, stderr) => {
                            if (!error) {
                                resolve({ stdout, stderr });
                                return;
                            }
                            reject(new CommandError(stderr));
                        }
                    );
                })
                .catch(function () {
                    // command doesn't exist
                    reject(new CommandNotFoundError());
                });
        });
    }