Processes created using spawn with a pipe have no /dev/stdin
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
- Version: v8.9.4
- Platform: Linux 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64 GNU/Linux
- Subsystem: child_process
The code below fails with cat: /dev/stdin: No such device or address.
const {spawn} = require('child_process');
const proc = spawn('cat', ['/dev/stdin'], {stdio: ['pipe', process.stdout, process.stderr]});
Apparently Node spawns sub processes in a way that there is no /dev/stdin allocated.
I think this is a NodeJS bug - on UNIX, a sub process should be able to open /dev/stdin if there is a stdin for it. The following Go program for example works perfectly fine:
func main() {
cmd := exec.Command("cat", "/dev/stdin")
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
stdin, _ := cmd.StdinPipe()
go func() {
stdin.Write([]byte("hello cat!\n"))
stdin.Close()
}()
cmd.Run()
}
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne im child_process-Subsystem von Node.js und reproduziere das bereitgestellte Beispiel spawn('cat', ['/dev/stdin'], ...) unter Linux, wobei du es mit dem Go-Beispiel vergleichst. Als erledigt gilt die Aufgabe, wenn das erwartete Unix-stdin-Verhalten bestätigt ist und der gemeldete Fehler durch einen Regressionstest abgedeckt wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, linux, node.js
- Bereich
- backend, operating-systems
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100