Skip to content

templ generate with --cmd should pass os.Stdin #1194

@jackielii

Description

@jackielii

Before you begin
Please make sure you're using the latest version of the templ CLI (go install github.com/a-h/templ/cmd/templ@latest), and have upgraded your project to use the latest version of the templ runtime (go get -u github.com/a-h/templ@latest)

Running on head of main: 9b34663

Describe the bug
A clear and concise description of what the bug is.

Run templ generate --include-version=false -cmd "go run main.go" when main.go contains code that reads terminal. E.g.

import "golang.org/x/term"

if term.IsTerminal(0) {
	width, _, err := term.GetSize(0)
	println("Terminal width:", width)
}

This will print 0 because terminal can't be detected

To Reproduce
A small, self-contained, complete reproduction, uploaded to a GitHub repo, containing the minimum amount of files required to reproduce the behaviour, along with a list of commands that need to be run. Keep it simple.

See above reproducible example.

Expected behavior
A clear and concise description of what you expected to happen.

term.IsTerminal(0) should return true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions