diff --git a/src/storage/filesystem.js b/src/storage/filesystem.js index 925b0293f..ffa286d95 100644 --- a/src/storage/filesystem.js +++ b/src/storage/filesystem.js @@ -113,13 +113,13 @@ function copy(apiConfig, oldFilePath, newFilePath) { assert.strictEqual(typeof oldFilePath, 'string'); assert.strictEqual(typeof newFilePath, 'string'); - debug('copy: %s -> %s', oldFilePath, newFilePath); - var events = new EventEmitter(); mkdirp(path.dirname(newFilePath), function (error) { if (error) return events.emit('done', new BackupsError(BackupsError.EXTERNAL_ERROR, error.message)); + events.emit('progress', `Copying ${oldFilePath} to ${newFilePath}`); + // this will hardlink backups saving space var cpOptions = apiConfig.noHardlinks ? '-a' : '-al'; shell.spawn('copy', '/bin/cp', [ cpOptions, oldFilePath, newFilePath ], { }, function (error) { @@ -155,7 +155,7 @@ function removeDir(apiConfig, pathPrefix) { var events = new EventEmitter(); - events.emit('progress', `removeDir: ${pathPrefix}`); + process.nextTick(() => events.emit('progress', `Removing directory ${pathPrefix}`)); shell.spawn('removeDir', '/bin/rm', [ '-rf', pathPrefix ], { }, function (error) { if (error) return events.emit('done', new BackupsError(BackupsError.EXTERNAL_ERROR, error.message));