src/extensions/default/AutoUpdate/node/AutoUpdateDomain.js
function parseInstallerLog(filepath, searchstring, encoding, callback) {
        var line = "";
        var searchFn = function searchFn(str) {
            var arr = str.split('\n'),
                lineNum,
                pos;
            for (lineNum = arr.length - 1; lineNum >= 0; lineNum--) {
                var searchStrNum;
                for (searchStrNum = 0; searchStrNum < searchstring.length; searchStrNum++) {
                    pos = arr[lineNum].search(searchstring[searchStrNum]);
                    if (pos !== -1) {
                        line = arr[lineNum];
                        break;
                    }
                }
                if (pos !== -1) {
                    break;
                }
            }
            callback(line);
        };

        fs.readFile(filepath, {"encoding": encoding})
            .then(function (str) {
                return searchFn(str);
            }).catch(function () {
                callback("");
            });
    }
function parseInstallerLog(filepath, searchstring, encoding, callback) {
        var line = "";
        var searchFn = function searchFn(str) {
            var arr = str.split('\n'),
                lineNum,
                pos;
            for (lineNum = arr.length - 1; lineNum >= 0; lineNum--) {
                var searchStrNum;
                for (searchStrNum = 0; searchStrNum < searchstring.length; searchStrNum++) {
                    pos = arr[lineNum].search(searchstring[searchStrNum]);
                    if (pos !== -1) {
                        line = arr[lineNum];
                        break;
                    }
                }
                if (pos !== -1) {
                    break;
                }
            }
            callback(line);
        };

        fs.readFile(filepath, {"encoding": encoding})
            .then(function (str) {
                return searchFn(str);
            }).catch(function () {
                callback("");
            });
    }
function parseInstallerLog ( filepath , searchstring , encoding , callback ) { var line = "" ; var searchFn = function searchFn ( str ) { var arr = str . split ( '\n' ) , lineNum , pos ; for ( lineNum = arr . length - 1 ; lineNum >= 0 ; lineNum -- ) { var searchStrNum ; for ( searchStrNum = 0 ; searchStrNum < searchstring . length ; searchStrNum ++ ) { pos = arr [ lineNum ] . search ( searchstring [ searchStrNum ] ) ; if ( pos !== - 1 ) { line = arr [ lineNum ] ; break ; } } if ( pos !== - 1 ) { break ; } } callback ( line ) ; } ; fs . readFile ( filepath , { "encoding" : encoding } ) . then ( function ( str ) { return searchFn ( str ) ; } ) . catch ( function ( ) { callback ( "" ) ; } ) ; }
Parse the Installer log and search for a error strings
one it finds the line which has any of error String
it return that line and exit
Parse the Installer log and search for a error strings one it finds the line which has any of error String it return that line and exit