oclif/plugin-update

Update doesn't work on Windows

lucaslugao opened this issue · 2 comments

I set up the plugin to publish to s3. All works fine on linux but on Windows 10 the update seems to fail silently.

Expected Behavior

$ mycli --version 
> mycli/1.0.0 win32-x64 node-v11.10.0

$ mycli update
> mycli: Updating CLI from 1.0.0 to 2.0.0... done
> mycli: Updating CLI... done

$ mycli --version 
> mycli/2.0.0 win32-x64 node-v11.10.0

Actual Behavior

$ mycli --version 
> mycli/1.0.0 win32-x64 node-v11.10.0

$ mycli update
> mycli: Updating CLI from 1.0.0 to 2.0.0... done
> mycli: Updating CLI... done

$ mycli --version 
> mycli/1.0.0 win32-x64 node-v11.10.0

I'm seeing the same issue on Windows (and not Linux/macOS), but I think I've narrowed it down (at least for my case). I believe it's related to having a config where the name is different from bin. For instance, my app's name is myapp-cli and the bin is myapp. It looks like the config, cache, and data directory configuration is all looking in %LOCALAPPDATA%\myapp-cli, but the myapp.cmd that gets generated during oclif-dev pack will look for the bin dir under %LOCALAPPDATA%:

if not "%MYAPP_REDIRECTED%"=="1" if exist "%LOCALAPPDATA%\myapp\client\bin\myapp.cmd" (
  set MYAPP_REDIRECTED=1
  "%LOCALAPPDATA%\myapp\client\bin\myapp.cmd" %*
  goto:EOF
)

as seen in its source. Since it can't find the updated files, it falls back to the original version, which is why we're seeing the non-updated release.

Since my app isn't released yet, I can fix this by making them match, but there's probably something easier/cleaner that can be done to address this more generally.

Closing this due to lack of activity - please open a new issue if this is still happening on the latest version