I'm trying to build a quick auto-updater in Perl Windows. I've noticed that when I call cpanp
to install the update of the package it fails to install a new version of the script because the script is currently running. I'm calling cpanp
with CORE::system()
currently. If I called cpanp
with exec()
would that release the executable for replacement? Or, does Windows keep it tied up even though execution has been turned over entirely to cpanp
?
Currently, my process flow looks something like this,
- Download META.yml from server
- Parse out the version of META.yml
- Compare against the current
$VERSION
- If the current version is lower, generate a version string using the data in META.yml
- Generate a URL to package using the host/path fo META.yml and the version/data information
- Inform user of update
- Spawn
cpanp
to run update with URL.
- If the current version is the same
- Do nothing
- If the current version is lower, generate a version string using the data in META.yml
Would system()
behave differently than exec()
on Win32 with regard to replacement of the executable? On Linux it works as designed.