@whyour/qinglong 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whyour/qinglong",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Timed task management platform supporting Python3, JavaScript, Shell, Typescript",
5
5
  "repository": {
6
6
  "type": "git",
@@ -383,20 +383,24 @@ function emptyDir(path) {
383
383
  fs.rmdirSync(path);
384
384
  }
385
385
  exports.emptyDir = emptyDir;
386
- function promiseExec(command) {
387
- return new Promise((resolve, reject) => {
388
- (0, child_process_1.exec)(command, { maxBuffer: 200 * 1024 * 1024, encoding: 'utf8' }, (err, stdout, stderr) => {
389
- resolve((stdout || stderr || err ? JSON.stringify(err) : '').trim());
390
- });
391
- });
386
+ async function promiseExec(command) {
387
+ try {
388
+ const { stderr, stdout } = await (0, util_1.promisify)(child_process_1.exec)(command, { maxBuffer: 200 * 1024 * 1024, encoding: 'utf8' });
389
+ return stdout || stderr;
390
+ }
391
+ catch (error) {
392
+ return JSON.stringify(error);
393
+ }
392
394
  }
393
395
  exports.promiseExec = promiseExec;
394
- function promiseExecSuccess(command) {
395
- return new Promise((resolve) => {
396
- (0, child_process_1.exec)(command, { maxBuffer: 200 * 1024 * 1024, encoding: 'utf8' }, (err, stdout, stderr) => {
397
- resolve(stdout || '');
398
- });
399
- });
396
+ async function promiseExecSuccess(command) {
397
+ try {
398
+ const { stdout } = await (0, util_1.promisify)(child_process_1.exec)(command, { maxBuffer: 200 * 1024 * 1024, encoding: 'utf8' });
399
+ return stdout || '';
400
+ }
401
+ catch (error) {
402
+ return '';
403
+ }
400
404
  }
401
405
  exports.promiseExecSuccess = promiseExecSuccess;
402
406
  function parseHeaders(headers) {