hdw2
Version:
鸿蒙前端hdc调试工具
29 lines (24 loc) • 753 B
JavaScript
/*
* @Author: tankunpeng
* @Date: 2024-06-26 19:47:35
* @LastEditTime: 2024-09-02 09:47:33
* @LastEditors: tankunpeng
* @Description: 执行hdc shell命令
* Come on, worker!
*/
const shell = require('shelljs');
const chalk = require('chalk');
const child_process = require('child_process');
const { getHdc } = require('./util');
function printTitle(text = '=====>执行hdc shell命令结束<=====') {
shell.echo(chalk.italic(chalk.bold(chalk.blue(text))));
}
function hdcShell(options = {}, command = {}) {
const hdc = getHdc();
printTitle('=====>执行hdc shell命令开始<=====');
child_process.spawnSync(hdc, ['shell', ...command.args], {
stdio: 'inherit'
});
printTitle();
}
exports.hdcShell = hdcShell;