Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

274
Views
How to run a cmd command in the current Terminal

I have a simple issue involding child_proccess. If you call child_process from a script its going to run that command in that script. If you export a function that runs the command, for what i've tested, it tries to run the command in the library terminal and not the current terminal. Example: Lets say you have your script a.js that you export to b.js and in a.js you have this function called hello that prints "Hello World" with the echo command:

//a.js
export function hello(){
  child_process.execSync("echo Hello World");
}
import {hello} from "a.js"
hello();

When you run it it will not send you anything. If you print "Hello World" with console.log() it will return it in the current terminal. Is there a way to execute a cmd command in the current terminal?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The command is actually running on the same terminal. Since you have not asked the child_process to direct the stdout to the current terminal, it does not print anything.

//a.js
export function hello(){
  child_process.execSync("echo Hello World",{stdio:"inherit"});
}

This should work fine.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!