Activate packages immediately if hook had already been triggered #13372

merged 2 commits into from Dec 5, 2016


None yet

2 participants

as-cii commented Dec 2, 2016 edited

Refs: #13200 (comment)

This pull request fixes a subtle bug that prevented hooks from being triggered on packages that were activated after Atom's initialization. In particular, when installing or disabling/enabling a package that relied on the core:loaded-shell-environment hook, such package would never activate because the hook had already been triggered.

This problem was not specific to core:loaded-shell-environment: in facts, the grammar-used hook was affected by it as well, although it was less evident because a grammar-used hook is emitted every time a new file is opened, rather than just once as it happens for core:loaded-shell-environment.

With this pull request, when a package is activated (either after installing it or after re-enabling it) we will re-trigger all the activation hooks that have been triggered until that moment. In addition, after a package has been successfully activated, we will stop listening to further activation (hooks and commands) events for that specific package.

/cc: @atom/maintainers @joefitzgerald

as-cii added some commits Dec 2, 2016
@as-cii as-cii Activate packages immediately if hook had already been triggered
@as-cii as-cii Add precondition test
@as-cii as-cii merged commit 7f4b430 into master Dec 5, 2016

5 checks passed

ci/circleci Your tests passed on CircleCI!
continuous-integration/appveyor/branch AppVeyor build succeeded
continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed
continuous-integration/travis-ci/push The Travis CI build passed
@as-cii as-cii deleted the as-fix-package-activation-hook branch Dec 5, 2016
@as-cii as-cii referenced this pull request Dec 5, 2016

Reported potential regressions in v1.12 release #13198

11 of 12 tasks complete
@facebook-github-bot facebook-github-bot added a commit to facebook/nuclide that referenced this pull request Dec 15, 2016
@hansonw @facebook-github-bot hansonw + facebook-github-bot Impose a 10 second timeout on core:loaded-shell-environment hook
Atom 1.12.6 and below have a bug where activation hooks don't trigger if they register too late

To work around this, impose a generous 10s timeout on the hook.

Changelog: Fix bug causing Mercurial operations to sometimes never terminate.

Reviewed By: mostafaeweda

Differential Revision: D4330786

fbshipit-source-id: 19adf5f1592659b563c39beb91d304b2850fb65f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment