As a part of my script, I want to publish package to nuget feed:
dotnet nuget push package.1.2.3.nupkg --source "mysource" --api-key "mykey"
The command may print
error: 409 already contains version 1.2.3 and exit with code 1. This is perfectly fine in my context, but it makes the whole script fail. I want to wrap this command with something, that will swallow non-zero exit code if specific error appears in stdout, but to bubble up non-zero exit code if it does not appear. What can I use for my task?