RepositoryJavaScriptPTPortugal
MO

moxystudio/node-cross-spawn

A cross platform solution to node's spawn and spawnSync

1.2kstars
139forks
28issues
0views

🔄 cross-spawn: Spawn lệnh đa nền tảng, không lỗi trên Windows

cross-spawn là giải pháp thay thế spawn và spawnSync của Node.js hoạt động đúng trên cả Windows và Linux/macOS.

cross-spawn ra đời để khắc phục những hạn chế khi dùng spawn trên Windows, nơi Node.js thường bỏ qua PATHEXT, không hỗ trợ shebang, và gặp lỗi với đường dẫn có chứa dấu cách hoặc đường dẫn tương đối kiểu POSIX.

✨ Điểm nổi bật

  • Hỗ trợ PATHEXT: Tìm và thực thi đúng tệp thực thi dựa trên phần mở rộng trên Windows.
  • Hỗ trợ shebang: Chạy các tệp có shebang #!/usr/bin/env <program> trên Windows.
  • Xử lý đường dẫn có dấu cách: Tránh lỗi cú pháp khi tên lệnh hoặc tham số chứa khoảng trắng.
  • Hỗ trợ đường dẫn tương đối POSIX: Chạy lệnh dạng ./my-folder/my-executable mà không lỗi.
  • Xử lý shims trong node_modules/.bin/: Tránh lỗi cú pháp với tham số chứa dấu ngoặc hoặc trích dẫn.
  • Tương thích options.shell: Hỗ trợ tùy chọn shell ngay cả trên Node.js cũ (< v4.8).
  • Drop-in replacement: Dùng thay thế trực tiếp cho spawn và spawnSync mà không cần thay đổi cú pháp.

💡 Vì sao đáng chú ý

Không giống các thư viện khác như win-spawn bị lỗi hoặc escape tham số sai, cross-spawn xử lý đúng cách trên cả Windows và Linux. Đặc biệt, nó tự động escape lệnh và tham số đúng cách, tránh rủi ro bảo mật khi dùng options.shell thủ công.


#NodeJS #cross-spawn #cross-platform #spawn #Windows #OpenSource #TiniX

Similar Projects

Discover other similar projects and AI models.

RepositoryDart
Predidit/Kazumi

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

39.8k
Oct 26, 2026
RepositoryDart
flutter/flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond

180.4k
Oct 26, 2026
RepositoryC++
react/react-native

A framework for building native applications using React

126.8k
Oct 26, 2026
RepositoryJavaScript
google/zx

A tool for writing better scripts

45.8k
Oct 23, 2026
RepositoryJavaScript
sindresorhus/execa

Process execution for humans

7.6k
Oct 18, 2026
RepositoryJavaScript
ztalbot2000/homebridge-cmd4

CMD4 Plugin for Homebridge - Supports ~All Accessory Types & now all Characteristics too

158
Feb 3, 2026
RepositoryJavaScript
nodejs/node

Node.js JavaScript runtime ✨🐢🚀✨

123.1k
Oct 27, 2026
RepositoryC++
microsoft/terminal

The new Windows Terminal and the original Windows console host, all in the same place!

105.2k
Oct 23, 2026
RepositoryC++
keepassxreboot/keepassxc

KeePassXC is a cross-platform community-driven port of the Windows application “KeePass Password Safe”.

29.5k
Oct 23, 2026