mirror of
https://github.com/gchq/CyberChef
synced 2024-11-15 00:57:08 +00:00
Tidied up chainCommands function in Gruntfile
This commit is contained in:
parent
1831c84a29
commit
17c9ffe107
1 changed files with 20 additions and 12 deletions
32
Gruntfile.js
32
Gruntfile.js
|
@ -14,18 +14,6 @@ const path = require("path");
|
|||
* @license Apache-2.0
|
||||
*/
|
||||
|
||||
const chainCommands = function(cmds) {
|
||||
const win = process.platform === "win32";
|
||||
if (!win) {
|
||||
return cmds.join(";");
|
||||
}
|
||||
return cmds
|
||||
// Chain Command is different here
|
||||
.join("&&")
|
||||
// Windows does not support \n properly
|
||||
.replace("\n", "\\n");
|
||||
};
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.file.defaultEncoding = "utf8";
|
||||
grunt.file.preserveBOM = false;
|
||||
|
@ -113,6 +101,26 @@ module.exports = function (grunt) {
|
|||
return entryModules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects the correct delimiter to use to chain shell commands together
|
||||
* based on the current OS.
|
||||
*
|
||||
* @param {string[]} cmds
|
||||
* @returns {string}
|
||||
*/
|
||||
function chainCommands(cmds) {
|
||||
const win = process.platform === "win32";
|
||||
if (!win) {
|
||||
return cmds.join(";");
|
||||
}
|
||||
return cmds
|
||||
// && means that subsequent commands will not be executed if the
|
||||
// previous one fails. & would coninue on a fail
|
||||
.join("&&")
|
||||
// Windows does not support \n properly
|
||||
.replace("\n", "\\n");
|
||||
}
|
||||
|
||||
grunt.initConfig({
|
||||
clean: {
|
||||
dev: ["build/dev/*"],
|
||||
|
|
Loading…
Reference in a new issue