From 6de31de6bfac27c3e65ce48b33b3984635dc1df8 Mon Sep 17 00:00:00 2001 From: Nikolay Edigaryev Date: Thu, 4 May 2023 14:02:46 +0400 Subject: [PATCH] tart login: trim newline characters at the end of --password-stdin (#486) --- Sources/tart/Commands/Login.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/tart/Commands/Login.swift b/Sources/tart/Commands/Login.swift index 8c98f43..748968a 100644 --- a/Sources/tart/Commands/Login.swift +++ b/Sources/tart/Commands/Login.swift @@ -35,6 +35,9 @@ struct Login: AsyncParsableCommand { let passwordData = FileHandle.standardInput.readDataToEndOfFile() password = String(decoding: passwordData, as: UTF8.self) + + // Support "echo $PASSWORD | tart login --username $USERNAME --password-stdin $REGISTRY" + password.trimSuffix { c in c.isNewline } } else { (user, password) = try StdinCredentials.retrieve() }