public async runCommand()

in src/appservice-rest/Kudu/azure-app-kudu-service.ts [147:176]


    public async runCommand(physicalPath: string, command: string): Promise<void> {
        var httpRequest: WebRequest = {
            method: 'POST',
            uri: this._client.getRequestUri(`/api/command`),
            headers: {
                'Content-Type': 'multipart/form-data',
                'If-Match': '*'
            },
            body: JSON.stringify({
                'command': command,
                'dir': physicalPath
            })
        };

        try {
            core.debug('Executing Script on Kudu. Command: ' + command);
            let webRequestOptions: WebRequestOptions = {retriableErrorCodes: null, retriableStatusCodes: null, retryCount: 5, retryIntervalInSeconds: 5, retryRequestTimedout: false};
            var response = await this._client.beginRequest(httpRequest, webRequestOptions);
            core.debug(`runCommand. Data: ${JSON.stringify(response)}`);
            if(response.statusCode == 200) {
                return ;
            }
            else {
                throw response;
            }
        }
        catch(error) {
            throw Error(error.toString());
        }
    }