mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
Only spawn removed command for paths that exist
Prevents errors being logged when trying to remove folders that don't exist on Windows.
This commit is contained in:
parent
776e8a308c
commit
3b6711d83d
11
script/clean
11
script/clean
@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
var cp = require('./utils/child-process-wrapper.js');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var os = require('os');
|
||||
|
||||
@ -30,8 +31,14 @@ var run = function() {
|
||||
var next = commands.shift();
|
||||
if (!next)
|
||||
process.exit(0);
|
||||
if (Array.isArray(next))
|
||||
next = removeCommand + path.resolve.apply(path.resolve, next);
|
||||
|
||||
if (Array.isArray(next)) {
|
||||
var pathToRemove = path.resolve.apply(path.resolve, next);
|
||||
if (fs.existsSync(pathToRemove))
|
||||
next = removeCommand + pathToRemove;
|
||||
else
|
||||
run();
|
||||
}
|
||||
cp.safeExec(next, run);
|
||||
};
|
||||
run();
|
||||
|
Loading…
Reference in New Issue
Block a user