Ich versuche, den cURL-Befehl auszuführen RVM und Rubin über child_process.spawn
zu installieren, aber es immer Fehler heraus: Streaming-Antwort von child_process.spawn curl Anfrage
let spawnProcess = spawn('\curl -sSL https://get.rvm.io | bash -s stable --ruby')
spawnProcess.stdout.on('data', data => {
console.log('DATA RECEIVED')
console.log(data)
})
spawnProcess.stdout.on('close',() => {
alert('done!')
})
spawnProcess.stderr.on('data', function(){
console.log('ON DATA')
console.log(arguments)
})
spawnProcess.on('error', error => {
console.log('ON ERROR')
console.log(JSON.stringify(error), error)
})
Der Fehler, den ich erhalten ist:
{"code":"ENOENT","errno":"ENOENT","syscall":"spawn curl -sSL https://get.rvm.io | bash -s stable --ruby","path":"curl -sSL https://get.rvm.io | bash -s stable --ruby","spawnargs":[]} Error: spawn curl -sSL https://get.rvm.io | bash -s stable --ruby ENOENT
at exports._errnoException (util.js:890:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:182:32)
at onErrorNT (internal/child_process.js:348:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
die JSON-prettified Version, ohne die Stacktrace ist:
{
"code": "ENOENT",
"errno": "ENOENT",
"syscall": "spawn curl -sSL https://get.rvm.io | bash -s stable --ruby",
"path": "curl -sSL https://get.rvm.io | bash -s stable --ruby",
"spawnargs": []
}
Es funktioniert gut, wenn ich child_process.exec
verwende, aber ich möchte in der Lage sein, die Ausgabe zu streamen.