Skip to content

Commit 9e2c9d4

Browse files
authored
fix box.json getting emptied on Ctrl-C (#501)
1 parent f1d8104 commit 9e2c9d4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Commands/BuildCommand.php

+8-6
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,15 @@ function () use ($configFile, $config) {
208208

209209
private function clear(): void
210210
{
211-
File::put($this->app->configPath('app.php'), self::$config);
212-
213-
File::put($this->app->basePath('box.json'), self::$box);
214-
215-
self::$config = null;
211+
if (self::$config !== null) {
212+
File::put($this->app->configPath('app.php'), self::$config);
213+
self::$config = null;
214+
}
216215

217-
self::$box = null;
216+
if (self::$box !== null) {
217+
File::put($this->app->basePath('box.json'), self::$box);
218+
self::$box = null;
219+
}
218220
}
219221

220222
/**

0 commit comments

Comments
 (0)