Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

🎲 Run shell command with exec asynchronously

License

NotificationsYou must be signed in to change notification settings

msaaddev/node-async-exec

versiondownloadslicense

A package that runs exec command asynchronously and also changes directory if needed to run commands.

Features

  • Asynchronously run a shell command.
  • Run a shell command/commands inside a specific directory.
  • Usesexec node method andprocess.chdir under the hood.
  • Can be used to build CLI and Node.js based tools.

Install

# install the packagenpm install node-async-exec

Usage

  • Run a shell command
constexec=require('node-async-exec');(async()=>{try{awaitexec({cmd:`touch example.md`})}catch(err){console.log(err);}})()
  • Change directory and run a command inside of it
constexec=require('node-async-exec');(async()=>{try{awaitexec({path:`/Users/saadirfan/GitHub`,cmd:`touch example.md`})}catch(err){console.log(err);}})()
  • Change directory and run a number of shell command inside that directory
constexec=require('node-async-exec');(async()=>{try{constcommands=[`git init`,`touch example.md`];awaitexec({path:`/Users/saadirfan/GitHub`,cmd:commands})}catch(err){console.log(err);}})()

⚡️ Other Projects

I have curated adetailed list of all the open-source projects I have authored. Do take out a moment and take a look.

🔑 License & Conduct

About

🎲 Run shell command with exec asynchronously

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp