Hello yarn berry

This commit is contained in:
undefined committed 2021-05-26 23:35:36 +08:00
1 parent 04a4306895
commit 782f334a27
62 files changed
+448 -239

No files matched your search

+6 -5
View File
@@ -1,12 +1,13 @@
import Axios from 'axios';
import fs from 'fs-extra';
import { argv } from 'yargs';
import cac from 'cac';
import * as STATUS from './status';
import { FormatError, SystemError } from './error';
import { cmd, parseMemoryMB } from './utils';
import { getConfig } from './config';
import { Logger } from './log';
const argv = cac().parse();
const logger = new Logger('sandbox');
let callId = 0;
@@ -90,9 +91,9 @@ export async function runMultiple(execute) {
body.cmd[1].files[0] = null;
body.cmd[1].files[1] = null;
const id = callId++;
if (argv['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(body));
if (argv.options['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(body));
res = await Axios.create({ baseURL: getConfig('sandbox_host') }).post('/run', body);
if (argv['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(res.data));
if (argv.options['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(res.data));
} catch (e) {
if (e instanceof FormatError) throw e;
throw new SystemError('Sandbox Error');
@@ -113,9 +114,9 @@ export async function run(execute, params?) {
try {
const body = { cmd: [proc({ execute, ...params })] };
const id = callId++;
if (argv['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(body));
if (argv.options['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(body));
const res = await Axios.create({ baseURL: getConfig('sandbox_host') }).post('/run', body);
if (argv['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(res.data));
if (argv.options['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(res.data));
[result] = res.data;
} catch (e) {
if (e instanceof FormatError) throw e;