Comments (5)
perhaps its the spaces? Not sure what OS you are on.
from node-cmd.
Windows.
Have you tried the multi-line example on Windows..?
from node-cmd.
Have you tried without the leading spaces and line breaks? Or by using the standard multi command pattern on windows. Linux, unix and mac support multiline commands by default. Perhaps windows does not? This is using only whatever is supported in the OS.
from node-cmd.
@stephen-last I had the same issue as you on windows. I had to modify the commands. On Windows you specify all commands on one line, separating them with ampersand.
cmd.get(
`git clone https://github.com/RIAEvangelist/node-cmd.git & cd node-cmd & ls`,
function(data, err, stderr){}
)
from node-cmd.
const os = require('os');
const cmd = require('node-cmd');
function nodeCmdOs(arr) {
return new Promise((resolve, reject) => {
let cmdStr = '';
if(os.type() === 'Windows_NT') {
arr.forEach((item, index) => {
index === 0 ? cmdStr += item : cmdStr = cmdStr + ' & ' + item
});
} else {
arr.forEach((item, index) => {
index === 0 ? cmdStr += item : cmdStr = cmdStr + '\n' + item
});
}
cmd.get(cmdStr, function (err, data, stderr) {
if (!err) {
resolve()
} else {
reject(err)
}
}
);
})
}
exports = module.exports = nodeCmdOs;
from node-cmd.
Related Issues (20)
- How to use this to open an exe (Which is a CLI tool) and then fire commands HOT 1
- Output from get not displaying what outputs from the terminal HOT 2
- How to execute commands with ZSH environment HOT 1
- Not Calling Function Callback HOT 1
- Add options to exec HOT 2
- How to get stderr when using promises HOT 1
- async await example? HOT 1
- returns data missing HOT 1
- compgen -c is the only command that does not produce output HOT 1
- Can we run command as adminstrator HOT 1
- Getting stdout streaming HOT 1
- is this project still being maintained? HOT 1
- 苹果笔记本上可以使npm-cmd吗?
- Add get process by Id HOT 2
- Example Error? HOT 4
- Promise API? HOT 2
- answering to a CMD y/n prompt HOT 2
- how to kill a node-cmd process ?
- How do I run command with admin ?
- Does Node-Cmd the console close? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-cmd.