Skip to content

Some script events can't be run via `run-script` #2557

swalkinshaw opened this Issue Jan 6, 2014 · 4 comments

3 participants


Running composer run-script post-root-package-install for example gives the following error:

  Script "post-root-package-install" cannot be run with this command

Is there any reason why only certain script events are allowed here

Or is it just out of date? I'd be happy to add the missing ones if it's just an oversight.

Composer member
Seldaek commented Jan 6, 2014

I guess this one is just missing. Maybe a few others are. The point is though that some like post-package-install can't be executed like this because we would be missing a package argument to call the script.

sndpl commented Feb 18, 2014

So what would be the fix? I see that all (PRE | POST)PACKAGE(INSTALL | UPDATE | UNINSTALL) events are never fired? (if i grep for them I only find them in the ScriptEvents file). But this are PackageEvents, so they can't be used with the run script (right?). Same for the POST_ROOT_PACKAGE_INSTALL and POST_CREATE_PROJECT_CMD.

So this means only PRE_ARCHIVE_CMD, POST_ARCHIVE_CMD, PRE_AUTOLOAD_DUMP and POST_AUTOLOAD_DUMP are missing in the RunScriptCommand?

Composer member
Seldaek commented Feb 18, 2014

I think if you grep for dispatch(CommandEvent|Script) you find all those that can be safely dispatched by run-script. Others require a package arg and hence can not be dispatched properly.

So I'd say the following are missing:


As for the *_PACKAGE_* event ones, just for reference they're dispatched in the Installer class (search for dispatchPackageEvent) but as I said they can't be included in run-script.

@sndpl sndpl added a commit to sndpl/composer that referenced this issue Feb 18, 2014
@sndpl sndpl Fix for #2557, added missing run-scripts 5ee74f8
Composer member
Seldaek commented Mar 23, 2014

run-script has been updated to support all events that make sense.

@Seldaek Seldaek closed this Mar 23, 2014
@Seldaek Seldaek added the Feature label Mar 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.