mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 01:02:24 +01:00
use try/finally to make sure working-path restore on Exceptions (#1463)
* use try/finally to make sure working-path restore on Exceptions * Update functions.php * Update CHANGELOG.md * Update CHANGELOG.md * fixed CS
This commit is contained in:
parent
4ca0edd47f
commit
b8c81fab0e
@ -3,6 +3,8 @@
|
||||
## master
|
||||
[v6.0.5...master](https://github.com/deployphp/deployer/compare/v6.0.5...master)
|
||||
|
||||
### Fixed
|
||||
- fix within() to also restore the working-path when the given callback throws a Exception [#1463]
|
||||
|
||||
## v6.0.5
|
||||
[v6.0.4...v6.0.5](https://github.com/deployphp/deployer/compare/v6.0.4...v6.0.5)
|
||||
@ -337,6 +339,7 @@
|
||||
- Fixed remove of shared dir on first deploy
|
||||
|
||||
|
||||
[#1463]: https://github.com/deployphp/deployer/pull/1463
|
||||
[#1455]: https://github.com/deployphp/deployer/pull/1455
|
||||
[#1452]: https://github.com/deployphp/deployer/pull/1452
|
||||
[#1426]: https://github.com/deployphp/deployer/pull/1426
|
||||
|
@ -258,9 +258,12 @@ function cd($path)
|
||||
function within($path, $callback)
|
||||
{
|
||||
$lastWorkingPath = get('working_path', '');
|
||||
set('working_path', parse($path));
|
||||
$callback();
|
||||
set('working_path', $lastWorkingPath);
|
||||
try {
|
||||
set('working_path', parse($path));
|
||||
$callback();
|
||||
} finally {
|
||||
set('working_path', $lastWorkingPath);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user