• Andrew Gillis's avatar
    Improve error message when running key command that locks repo (#7821) · 6f6f0454
    Andrew Gillis authored
    * Improve error message when running key commands that must be run when the daemon is not already running
    
    Fixes Issue #7814
    
    `ipfs key export` now does a PreRun check like `ipfs key rotate` was to give a better error to the user then "someone else has the lock" in the event that the daemon is running while trying to execute these offline-only commands.
    
    While unlikely the "someone else has the lock" error can still be shown if two processes try and grab the repo lock at the same time.
    
    This PreRun function is also exported so it can be used by `ipfs init` where it was originally copied from.
    
    * Added more `ipfs key` command tests
    
    When daemon is running:
    - Test that import works
    - Test that export fails
    - Test that rotate fails
    6f6f0454
init.go 6.49 KB