Skip to content

adding pipe feature in cli - #84

Merged
Amos-Rai-KEYS merged 1 commit into
mainfrom
add-pipe-feature-cli
Sep 1, 2026
Merged

adding pipe feature in cli#84
Amos-Rai-KEYS merged 1 commit into
mainfrom
add-pipe-feature-cli

Conversation

@Amos-Rai-KEYS

Copy link
Copy Markdown
Collaborator

Summary

  • Allow infragraph translate <tool> | infragraph visualize --output OUT_DIR to work directly: translate writes its YAML/JSON to stdout instead of a file when --output is omitted and its stdout is an actual OS pipe, and visualize reads the infrastructure definition from stdin when --input is omitted and its stdin is an actual OS pipe.
  • Detection uses stat.S_ISFIFO on the fd (not just isatty()), so it only kicks in for a real shell | pipe — standalone runs and >-redirected output keep writing/reading files exactly as before.
  • Moved translate's status/log lines (e.g. translated output file ..., Annotated infragraph ... written to ...) from stdout to stderr so they never get mixed into piped or redirected data.

Test plan

  • infragraph translate lstopo --input <xml> still writes device.yaml with the status line printed (existing behavior unchanged).
  • infragraph translate lstopo --input <xml> > out.yaml still writes device.yaml (not out.yaml, which now stays empty since status moved to stderr) — confirms > redirection isn't mistaken for a pipe.
  • infragraph translate lstopo --input <xml> | infragraph visualize --output viz_out produces a working viz_out/index.html.
  • infragraph visualize --output viz_out with no --input and no piped stdin fails with a clear Invalid value for --input error instead of hanging or crashing.
  • infragraph visualize --input device.yaml --output viz_out (explicit file) still works unchanged.

@Amos-Rai-KEYS
Amos-Rai-KEYS merged commit a8488c6 into main Sep 1, 2026
1 check passed
@Amos-Rai-KEYS
Amos-Rai-KEYS deleted the add-pipe-feature-cli branch September 1, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants