runtime: println and panic messages go to stdout, not stderr

Aperta
#6,649 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
63/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go, wasm

Direzione di ricerca

Start by reading runtime_unix.go and runtime_tinygowasm.go, the two files named in the issue, and compare their output calls with Go's behavior. Check how targets with stderr are handled and whether targets without it need different behavior. Done means print, println, and panic output go to stderr on targets that provide it; verify with the example and 2>/dev/null.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Go writes the output of the print and println builtins and panic messages to stderr. TinyGo writes them to stdout on Linux (libc_write(1, ...) in runtime_unix.go) and on wasm (fd_write(stdout, ...) in runtime_tinygowasm.go).

package main

func main() {
	println("hello")
	panic("boom")
}

Run with 2>/dev/null, the Go build prints nothing, and the TinyGo build prints hello and panic: boom. A program whose stdout is data, such as one piped into another, gets these lines mixed into its output.

Is stdout intended on targets that have a stderr? If not, I can send a PR.

Lingua principale
Go
Stelle
17.8k
Fork
1.1k
Merge medio
1g 4h
PR unite (30g)
380

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di tinygo-org/tinygo

Tutte le issue di tinygo-org/tinygo

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.