Skip to content

Return error on tctl create with no file or stdin input - #69620

Open
barthc wants to merge 2 commits into
gravitational:masterfrom
barthc:barth/fix-14791
Open

Return error on tctl create with no file or stdin input#69620
barthc wants to merge 2 commits into
gravitational:masterfrom
barthc:barth/fix-14791

Conversation

@barthc

@barthc barthc commented Aug 12, 2026

Copy link
Copy Markdown

Close #14791

Changelog: Fixed a bug where tctl create would hang indefinitely instead of returning an error when run without a file or stdin input.

Manual Test Plan

Test Environment

Test Cases

  • [ ]

@github-actions github-actions Bot added size/sm tctl tctl - Teleport admin tool labels Aug 12, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de410cb950

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread tool/tctl/common/resource_command.go Outdated
Comment on lines +365 to +366
stat, _ := os.Stdin.Stat()
if (stat.Mode() & os.ModeCharDevice) != 0 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle stdin Stat errors before using FileInfo

When tctl create is invoked without a filename and stdin is closed or otherwise invalid, os.Stdin.Stat() returns a nil FileInfo with an error; ignoring that error makes the next line call stat.Mode() and panic instead of returning a normal CLI error. This can happen in automation that closes fd 0, and it is a regression from the decoder path returning an error rather than crashing. Please check and return/wrap the Stat error before inspecting the mode.

AGENTS.md reference: AGENTS.md:L16-L16

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/sm tctl tctl - Teleport admin tool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Running tctl create with no arguments causes terminal to lock up.

1 participant