UNPKG

chdman

Version:

💿 chdman binaries and wrapper for Node.js.

29 lines • 1.4 kB
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; import ChdmanBin from './chdmanBin.js'; export default { /** * Returns the chdman help message. */ help(options_1) { return __awaiter(this, arguments, void 0, function* (options, attempt = 1) { const output = yield ChdmanBin.run(['help']); // Try to detect failures, and then retry them automatically if (!output.trim() && attempt <= 3) { yield new Promise((resolve) => { setTimeout(resolve, Math.random() * (Math.pow(2, (attempt - 1)) * 20)); }); return this.help(options, attempt + 1); } return output; }); }, }; //# sourceMappingURL=chdmanHelp.js.map