Just hunted down an annoying bug in my CI/CD pipel...
# general
h
Just hunted down an annoying bug in my CI/CD pipeline -
pulumi stack output $PROPERTY
adds a newline even with
--non-interactive
specified. Can a special case be added with just the raw string for non-interactive usage? I believe the logic is here.
b
could you not just trim it?
Copy code
pulumi stack output $PROPERTY | tr -d '\n'
h
trimming the string after the fact is my workaround for now, but it's easy to forget to take care of this, not to mention potential corner cases. generally speaking - and IMHO - non-interactive output should be the norm for tools designed to be automated, seeing as we are unconditionally adding a newline in the first place. PS: i believe
sed -z '$ s/\n$//'
is a more accurate solution in a shell context - just for completeness' sake.
to clarify, i'm thinking about what is likely to be the more common use case here: invocation via scripts that reuse these outputs elsewhere, or humans checking these outputs interactively? IMO, a trailing newline could be added at the tail end of all CLI logic if an interactive session is detected, decoupling this from core logic. just my 2 cents - hope you don't mind. thanks