-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix overriding original backup upon previous failure #155
Conversation
What happens if you do |
Yeah there's a lot of scenarios for this... a simple exists for the copy of |
Or maybe you can just do |
Yes, that works? Just ignore any output from that because we don't need to know? Trying to think of anything else that might bug out... |
@bbashy Sure, but I would move the exists and compare logic to @themsaid isn't |
Opted for putting another check on the restoreEnv method call. I'll leave this to see what people think but I think this is the best bet without going overboard. |
src/Console/DuskCommand.php
Outdated
@@ -117,7 +117,7 @@ protected function withDuskEnvironment($callback) | |||
return tap($callback(), function () { | |||
$this->removeConfiguration(); | |||
|
|||
if (file_exists(base_path($this->duskFile()))) { | |||
if (file_exists(base_path($this->duskFile())) && file_exists(base_path('.env.backup')))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't there one superfluous )
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's hope that will get merged. Afterwards I'll try to get my phpunit.dusk.xml
thing from #154 merged. I probably should have made two PRs instead of a combined one 😆
One issue that remains with this approach is the following (less likely) flow:
But it's definitely much better than the current behavior. |
Is the file_exists() check on |
@georaldc You should probably open an issue since this PR didn't change that part of code. |
Only backup .env if it's not equal to the .env.dusk.[env]
This fixes issues when you ctrl+c the
php artisan dusk
command or it fails somehow without finishing the restore.