If I execute shell.exec('http') I get the help for httpie, a request library I use. However if I add an argument, like seen below, shelljs never calls the callback.
var shell = require('shelljs');
shell.exec('http http://www.example.com/', {async: true, silent: false}, function(data){
console.log(data);
})
The above example DOES work if I use curl instead of http. Any ideas why its not working with http?
Add ignore-stdin option
var shell = require('shelljs');
shell.exec('http --ignore-stdin http://www.example.com/', {async: true, silent: false}, function(data){
console.log(data);
});
The --ignore-stdin option prevents HTTPie from reading data from stdin, which is usually not desirable during non-interactive invocations.
You can read more in the Scripting section of httpie
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With