start shift to making bare bash obsolete

This commit is contained in:
2016-08-02 16:20:32 +02:00
parent 236df3388f
commit 2d9c225d28
17 changed files with 83 additions and 39 deletions

View File

@ -1,17 +1,27 @@
import "typings-global";
import * as plugins from "./npmci.plugins";
let nvmSourceString:string = "";
export let nvmAvailable:boolean = false;
let checkNvm = () => {
let nvmExecCode = plugins.shelljs.exec(`bash -c "source /usr/local/nvm/nvm.sh"`).code;
if(nvmExecCode === 0){
nvmSourceString = `source /usr/local/nvm/nvm.sh && `
nvmAvailable = true;
}
};
checkNvm();
export let bash = (commandArg:string,retryArg = 2,bareArg = false) => {
let exitCode:number;
let stdOut:string;
let execResult;
if(!process.env.NPMTS_TEST){
if(!process.env.NPMTS_TEST){ // NPMTS_TEST is used during testing
for (let i = 0; i <= retryArg; i++){
if(!bareArg){
execResult = plugins.shelljs.exec(
"bash -c \"source /usr/local/nvm/nvm.sh &&" +
commandArg +
"\""
`bash -c "${nvmSourceString} ${commandArg}"`
);
} else {
execResult = plugins.shelljs.exec(commandArg);

View File

@ -5,9 +5,9 @@ export let gulpFunction = require("gulp-function");
export let lodash = require("lodash");
export import path = require("path");
export import projectinfo = require("projectinfo");
export let q = require("q");
export import q = require("q");
export let request = require("request");
export let shelljs = require("shelljs");
export import shelljs = require("shelljs");
export import smartcli = require("smartcli");
export import smartfile = require("smartfile");
export import smartparam = require("smartparam");