advisor mapping create command consumes stdin causing shell loops to break - VMware Tanzu Spring Application Advisor
search cancel

advisor mapping create command consumes stdin causing shell loops to break - VMware Tanzu Spring Application Advisor

book

Article ID: 453678

calendar_today

Updated On:

Products

VMware Tanzu Spring Runtime

Issue/Introduction

The advisor mapping create command consumes stdin, which silently breaks shell loops that pipe data, such as while read ... do advisor ... done. This behavior prevents automated workflows from executing commands sequentially as the CLI consumes the stream intended for the loop.

Environment

  • Product: VMware Tanzu Spring Application Advisor
  • Component: Application Advisor CLI (versions prior to 1.6.7)
  • Operating System: Linux/Unix-based systems
  • Condition: Execution of advisor mapping create within shell scripting loops piping data to stdin.

Cause

The advisor mapping create command attempts to read from stdin by default. This causes the CLI to consume the input stream meant for parent shell loops, resulting in premature termination of the loop process.

Resolution

Ensure the Spring App Advisor CLI is updated to version 1.6.7 or later. Engineering has implemented a fix in 1.6.7 to ensure piped stdin survives the command invocation.

Workaround

If you are unable to immediately upgrade to a patched version of the CLI, you can force the tool to read an empty input stream.When executing automation scripts, redirect input from /dev/null for the specific command: 

advisor mapping create -c="<your-coordinate>" < /dev/null