core: add command execution log

This commit is contained in:
undefined committed 2021-12-02 22:12:55 +08:00
1 parent 1f46bcc16f
commit 006468cd24
2 files changed
+4 -2

No files matched your search

+3 -1
View File
@@ -24,8 +24,10 @@ const child = require('child_process');
const esbuild = require('esbuild');
const exec = (...args) => {
console.log('Executing: ', args[0], args[1].join(' '));
const res = child.spawnSync(...args);
if (res.error) throw res.error;
if (res.status) throw new Error(`Error: Exited with code ${res.status}`);
return res;
};
@@ -116,7 +118,7 @@ if (argv.args[0] === 'restore') {
exec('mongorestore', [`--uri=${url}`, `--dir=${dir}/dump/${JSON.parse(dbConfig).db}`, '--drop'], { stdio: 'inherit' });
if (fs.existsSync(`${dir}/file`)) {
exec('rm', ['-rf', '/data/file/*'], { stdio: 'inherit' });
exec('mv', ['-f', `${dir}/file/*`, '/data/file'], { stdio: 'inherit' });
exec('mv', [`${dir}/file/*`, '/data/file'], { stdio: 'inherit' });
}
if (fs.existsSync(`${dir}/env`)) {
fs.copySync(`${dir}/env`, `${os.homedir()}/.hydro/env`, { overwrite: true });
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "3.2.2",
"version": "3.2.3",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",