代码拉取完成,页面将自动刷新
同步操作将从 超腾开源/ShadowEditor 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*
* Copyright 2017-2020 The ShadowEditor Authors. All rights reserved.
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file.
*
* For more information, please visit: https://github.com/tengge1/ShadowEditor
* You can also visit: https://gitee.com/tengge1/ShadowEditor
*/
const { spawn } = require('child_process');
/**
* Execute a command
* @param {String} cmd bat or shell command
* @param {Array} args parameter array
* @param {Object} options exec options
* @param {String} options.title the title before the output
* @param {Boolean} options.showCmd whether to print the command
* @param {Boolean} options.trimSpace whether to trim the space of output
* @param {String} options.cwd current work directory
* @returns a promise that the command ended
*/
function exec(cmd, args = [], options = {}) {
if (options.showCmd === undefined) {
options.showCmd = true;
}
options.showCmd && console.log(`${cmd} ${args.join(' ')}`);
const cp = spawn(cmd, args, {
cwd: options.cwd
});
cp.stdout.on('data', data => {
let result = data.toString()
if (options.trimSpace) {
result = result.trim(' ');
}
if (options.title) {
result = `${options.title}: ${result}`;
}
console.log(result);
});
cp.stderr.on('data', data => {
console.error(data.toString());
});
return new Promise(resolve => {
cp.on('close', () => {
resolve();
});
});
}
module.exports = exec;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。