how to use child_process in ace command ? #3871
Answered
by
magic-thomas
magic-thomas
asked this question in
Help
-
I want to run linux command and get the result . I tried it with ace command but nothing returned. public async run() {
const { spawn } = require("child_process");
const ls = spawn("ls", ["-lh", "/usr"]);
ls.stdout.on("data", (data) => {
console.log(`stdout: ${data}`);
});
} how can I success it ? |
Beta Was this translation helpful? Give feedback.
Answered by
magic-thomas
Aug 18, 2022
Replies: 1 comment
-
I found solution. // in ace Command public async run() {
const { exitCode } = await execa.node('./node-commands/dir.js', ["-lh", "./"], {
stdio: 'inherit',
})
} // node-commands/dir.js const { spawn } = require("child_process");
const ls = spawn("ls", ["-lh", "/usr"]);
ls.stdout.on("data", (data) => {
console.log(`stdout: ${data}`);
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
magic-thomas
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found solution.
// in ace Command
// node-commands/dir.js