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

93
Views
Node.JS Child Process Change Type of Terminal

I'm using the Node JS child process to execute terminal commands and get the output of them, which is all going great. However, I'm on a WSL Windows machine, and I would like to change the type of the child processes terminal to zsh.

Below is my current code for executing a command and receiving the output.

async function execute(
    command: string,
    cwd: string,
): Promise<{ output: string; error: string }> {
    const out = await promisify(exec)(command, { cwd: cwd });

    const output = out.stdout.trim();
    const error = out.stderr.trim();

    return { output: output, error: error };
}

How can I change the type of the terminal from command prompt to zsh?

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

0

you can do this

exec(command , { shell : "zsh" })

you can read more about shell requirements here : https://nodejs.org/api/child_process.html#shell-requirements

So your code should look like this :

async function execute(
    command: string,
    cwd: string,
): Promise<{ output: string; error: string }> {
    const out = await promisify(exec)(command, { cwd: cwd , 
    shell:"zsh"});

    const output = out.stdout.trim();
    const error = out.stderr.trim();

    return { output: output, error: error };
}

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!