logic-helper
Version:
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
16 lines (15 loc) • 490 B
JavaScript
//nodejs run shell commands
const path = require('path');
const {exec} = require('child_process');
function runShellCommand(command) {
return new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => {
if (error) {
reject(error);
}
resolve(stdout);
});
});
}
runShellCommand(`node ${path.resolve(__dirname, '../server/koa/index.js')}`).then(console.log).catch(console.error);