apm icon indicating copy to clipboard operation
apm copied to clipboard

Better support for updating packages with native binaries on Windows

Open amejia1 opened this issue 7 years ago • 1 comments

Prerequisites

  • [X] Put an X between the brackets on this line if you have done all of the following:
    • Reproduced the problem in Safe Mode: http://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
    • Followed all applicable steps in the debugging guide: http://flight-manual.atom.io/hacking-atom/sections/debugging/
    • Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
    • Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
    • Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages

Description

I own the 'atom-xterm' package which depends on node-pty. On Windows, node-pty loads a few native binaries in order to be able to provide a terminal emulator. DLLs which are already loaded (such as the ones from node-pty) cannot be deleted until the processes using them are stopped. Therefore in order to updating DLLs, they should be renamed to a location on the same volume (see https://msdn.microsoft.com/en-us/library/windows/desktop/ms682604(v=vs.85).aspx).

I've had to implement a script to be used as a 'preinstall' script when installing/updating atom-xterm (see https://github.com/amejia1/atom-xterm/blob/master/scripts_src/move-winpty-binaries.js). So far, I'm doing a lot of guessing to determine the final install path for atom-xterm. It would be great if apm could provide utilities to deal with updating packages that contain DLLs. Setting an environment variable with the install path to an Atom package would be great. An environment variable pointing to a 'tmp' directory under the Atom home directory would also be great. A utility method/command for deleting renamed DLLs on system reboot would also be nice.

Steps to Reproduce

  1. On Windows, install atom-xterm using apm install [email protected].
  2. Have Atom started and ensure the atom-xterm plugin is loaded.
  3. Run apm install [email protected] again. This time you should see it be stuck until either Atom is exited or a timeout occurs.

Expected behavior: Either apm updates for packages with DLLs should just work or apm should have facilities to help Atom package authors to rename DLLs themselves.

Actual behavior: I have a not so ideal way of renaming DLLs (see https://github.com/amejia1/atom-xterm/blob/master/scripts/move-winpty-binaries.js). I have to guess where atom-xterm gets installed. I have to provide my own tmp directory under the Atom home directory. There's no utilities available which will help me to delete DLLs when the system restarts.

Reproduces how often: Any and all times I update atom-xterm on Windows.

Versions

You can get this information from copy and pasting the output of atom --version and apm --version from the command line. Also, please include the OS and what version of the OS you're running.

PS C:\Users\andre\github\atom-xterm> apm --version apm 1.18.4 npm 3.10.10 node 6.9.5 x64 python 2.7.13 git 2.14.0.windows.2 visual studio 2015

I'm using Windows 10.

Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.

amejia1 avatar Sep 12 '17 02:09 amejia1

Noting here, it doesn't matter if packages with prebuilt binaries are used (like node-pty-prebuilt). On Windows, the issue is the same.

amejia1 avatar Jan 22 '18 00:01 amejia1