oclif/plugin-update

a file missing error message appears on the first run of `update`

gregsadetsky opened this issue · 1 comments

Describe the bug

the first time that mycli update is run, an error message appears:

Error: ENOENT: no such file or directory, open '/Users/g/.local/share/mycli/client/bin/mycli'

To Reproduce
Steps to reproduce the behavior:

  1. create an oclif cli (calling it mycli here for simplicity)
  2. add plugin-update
  3. bundle the cli
  4. run mycli update
  5. the error appears. the CLI then updates itself normally. further runs of mycli update don't show this error message

Expected behavior

the error message should not appear i.e. the code that attempts to get the current binary version (see below) should fail gracefully

Environment (please complete the following information):

  • OS & version: macOS 12.7
  • Shell/terminal & version: zsh

Additional context

the error happens because of this line which attempts to open the cli binary to read its version. if the file is missing (as it is the very first time that update is run, since (on macs) the ~/.local/share/mycli/ directory doesn't exist), a warning is printed here

thank you for fixing this!