Skip to content
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: use polyfill module for copySync with node 4.x #3517

Merged
merged 1 commit into from
Mar 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/API/Startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var debug = require('debug')('pm2:cli:startup');
var chalk = require('chalk');
var path = require('path');
var fs = require('fs');
const fsExtra = require('fs-extra');
var async = require('async');
var exec = require('child_process').exec;
var Common = require('../Common.js');
Expand Down Expand Up @@ -396,7 +397,7 @@ module.exports = function(CLI) {
// Back up dump file
try {
if (fs.existsSync(cst.DUMP_FILE_PATH)) {
fs.copyFileSync(cst.DUMP_FILE_PATH, cst.DUMP_BACKUP_FILE_PATH);
fsExtra.copySync(cst.DUMP_FILE_PATH, cst.DUMP_BACKUP_FILE_PATH);
}
} catch (e) {
console.error(e.stack || e);
Expand All @@ -411,7 +412,7 @@ module.exports = function(CLI) {
try {
// try to backup file
if(fs.existsSync(cst.DUMP_BACKUP_FILE_PATH)) {
fs.copyFileSync(cst.DUMP_BACKUP_FILE_PATH, cst.DUMP_FILE_PATH);
fsExtra.copySync(cst.DUMP_BACKUP_FILE_PATH, cst.DUMP_FILE_PATH);
}
} catch (e) {
// don't keep broken file
Expand Down
5 changes: 3 additions & 2 deletions lib/God/ActionMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

var fs = require('fs');
const fsExtra = require('fs-extra');
var path = require('path');
var async = require('async');
var os = require('os');
Expand Down Expand Up @@ -155,7 +156,7 @@ module.exports = function(God) {
// Back up dump file
try {
if (fs.existsSync(cst.DUMP_FILE_PATH)) {
fs.copyFileSync(cst.DUMP_FILE_PATH, cst.DUMP_BACKUP_FILE_PATH);
fsExtra.copySync(cst.DUMP_FILE_PATH, cst.DUMP_BACKUP_FILE_PATH);
}
} catch (e) {
console.error(e.stack || e);
Expand All @@ -169,7 +170,7 @@ module.exports = function(God) {
try {
// try to backup file
if(fs.existsSync(cst.DUMP_BACKUP_FILE_PATH)) {
fs.copyFileSync(cst.DUMP_BACKUP_FILE_PATH, cst.DUMP_FILE_PATH);
fsExtra.copySync(cst.DUMP_BACKUP_FILE_PATH, cst.DUMP_FILE_PATH);
}
} catch (e) {
// don't keep broken file
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
"debug": "^3.0",
"eventemitter2": "5.0.1",
"fclone": "1.0.11",
"fs-extra": "^5.0.0",
"mkdirp": "0.5.1",
"moment": "^2.19",
"needle": "^2.2.0",
Expand Down