Skip to content

Commit 111e599

Browse files
committed
fix(install): don't fail install if debug logs are present
closes #173 - previously, `ghost install` would fail if there were debug log files present in the install directory. This PR fixes it so log files don't make the install exit
1 parent 86c81ee commit 111e599

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/commands/install.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22
const fs = require('fs-extra');
33
const path = require('path');
4+
const every = require('lodash/every');
45
const Listr = require('listr');
56
const Promise = require('bluebird');
67
const symlinkSync = require('symlink-or-copy').sync;
@@ -55,7 +56,10 @@ module.exports.execute = function execute(version, options) {
5556
process.chdir(dir);
5657
}
5758

58-
if (fs.readdirSync(process.cwd()).length) {
59+
let filesInDir = fs.readdirSync(process.cwd());
60+
61+
// Check if there are existing files that *aren't* ghost-cli debug log files
62+
if (filesInDir.length && !every(filesInDir, (file) => file.match(/^ghost-cli-debug-.*\.log$/i))) {
5963
return Promise.reject(new errors.SystemError('Current directory is not empty, Ghost cannot be installed here.'));
6064
}
6165

0 commit comments

Comments
 (0)