Closed jdhitsolutions closed 3 years ago
Did a little more digging and I think this is bug. My testing was in Windows PowerShell. Running the same command in PowerShell 7 provides the experience I was expecting.
I looked at the source and it looks like you are using a chain operator which Windows PowerShell can't use.
No, this is by design. Set-Secret
will overwrite an existing secret by default. Using the -NoClobber
switch means it will fail to store the secret. Since the cmdlet operation failed, a command terminating error is thrown.
I guess that really is the behavior. I tested other commands with a -NoClobber parameter and they do in fact throw an exception. Guess I had a misconception on this parameter.
This might be related to #95 but certainly isn't nice. If I run -NoClobber and try to set an existing secret, I get an exception.
Yes, I could use an ErrorAction to suppress it, but I shouldn't have to. At best, I could see a warning message indicating the secret wasn't set. Or don't show anything and provide that detail in verbose output.
Or is there a bug? I re-ran the command with Verbose output.
That first verbose message implies -NoClobber wasn't detected.