当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript child_process.execSync函数代码示例

本文整理汇总了TypeScript中child_process.execSync函数的典型用法代码示例。如果您正苦于以下问题:TypeScript execSync函数的具体用法?TypeScript execSync怎么用?TypeScript execSync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了execSync函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: run

function run(cmds: string) {
    console.log("running [" + cmds + "]");

    try {
        execSync(cmds);
    } catch (e) {
        console.error(e);
        throw(e);
    }
}
开发者ID:Ronmi,项目名称:react-boilerplate,代码行数:10,代码来源:utils.ts

示例2: constructor

    constructor(conf?: IDockerConf) {
        this.apiVersion = require("./package.json").version;
        this.dockerVersion = execSync("docker -v | grep version | awk '{print$3}' | sed 's/,//g'").toString("utf-8").replace('\n', '')

        this.composeVersion = execSync("docker-compose -v | grep compose | awk '{print$3}' | sed 's/,//g'").toString("utf-8").replace('\n', '')


        const configuration: IDockerConf = {
        }

        if (conf) {

            Object['assign'](configuration, conf)

        }

        this.options = configuration

    }
开发者ID:dottgonzo,项目名称:dockerlogs,代码行数:19,代码来源:index.ts

示例3: function

export default async function (options: { verbose: boolean }, logger: logging.Logger) {
  let error = false;

  logger.info('Running templates validation...');
  const templateLogger = logger.createChild('templates');
  if (execSync(`git status --porcelain`).toString()) {
    logger.error('There are local changes.');
    if (!options.verbose) {
      return 101;
    }
    error = true;
  }
  templates({}, templateLogger);
  if (execSync(`git status --porcelain`).toString()) {
    logger.error(tags.oneLine`
      Running templates updated files... Please run "devkit-admin templates" before submitting
      a PR.
    `);
    if (!options.verbose) {
      process.exit(2);
    }
    error = true;
  }

  logger.info('');
  logger.info('Running commit validation...');
  validateCommits({}, logger.createChild('validate-commits'));


  logger.info('');
  logger.info('Running license validation...');
  error = await validateLicenses({}, logger.createChild('validate-commits')) != 0;

  logger.info('');
  logger.info('Running BUILD files validation...');
  validateBuildFiles({}, logger.createChild('validate-build-files'));

  if (error) {
    return 101;
  }

  return 0;
}
开发者ID:fmalcher,项目名称:angular-cli,代码行数:43,代码来源:validate.ts

示例4: copy

    public static copy(str: string) {
        if (os.platform() !== 'darwin') {
            console.log('Warning: clipboard copy only works on Mac for now');
            return;
        }

        child_process.execSync('pbcopy', {
            input: str,
        });
    }
开发者ID:victorjacobs,项目名称:chullo-client,代码行数:10,代码来源:clipboard.ts

示例5: task

task('less', function () {
    // Promise.all([
    execSync('sh scripts/less.sh');
    // ]).then(() => {
    // getFilesFrom('./src', '.less').forEach((path) => {
    //     console.log(`Compile less file ${path}`);
    //     execSync(`node_modules/.bin/lessc ${path} ${path.replace('.less', '.css')}`);
    // });
    // });
});
开发者ID:beregovoy68,项目名称:WavesGUI,代码行数:10,代码来源:gulpfile.ts

示例6: isDotnetOnPath

function isDotnetOnPath() : boolean {
    try {
        child_process.execSync('dotnet --info');
        return true;
    }
    catch (err)
    {
        return false;
    }
}
开发者ID:Firaenix,项目名称:omnisharp-vscode,代码行数:10,代码来源:activate.ts

示例7: function

 this.findConnectionFile = function(ssid: string) {
   let files = [];
   try {
     files = execSync("sudo grep -rnwl /etc/NetworkManager/system-connections/ -e 'ssid=" + ssid + "' || true").toString().trim().split('\n');
   }
   catch(err) {
     console.log("sudo grep -rnwl /etc/NetworkManager/system-connections/ failed with: " + err.message);
   }
   return files;
 };
开发者ID:dconyers,项目名称:BalerDisplay,代码行数:10,代码来源:WifiService.ts

示例8: zipMission

// Horrible way to do this. We only allow alphanum and underscroe, so no remote code execution shouldn't happen?.
// Sadly I haven't found a JS module that can zip a folder the way I want ...
function zipMission(missionDir: string, missionDirName: string): string {
    var missionZipName = `${missionDirName}.zip`,
        missionZip = `${missionDir}.zip`;
    var zipCommand = `7z a ${missionZip} ./${missionDir}/*`;
    if (process.platform === 'linux') {
        zipCommand = `(cd ${missionDir} ; zip -r ${missionZipName} . ; mv ${missionZipName} .. ; cd -)`;
    }
    cp.execSync(zipCommand);
    return missionZipName;
}
开发者ID:Cyruz143,项目名称:shipyard,代码行数:12,代码来源:App.ts

示例9: test

 test('uses the --root value option as loader root', async () => {
   const stdout =
       execSync([
         `node ${
             cliPath} --root test/html --inline-scripts --inline-css absolute-paths.html`,
       ].join(' && '))
           .toString();
   assert.include(stdout, '.absolute-paths-style');
   assert.include(stdout, 'hello from /absolute-paths/script.js');
 });
开发者ID:MehdiRaash,项目名称:tools,代码行数:10,代码来源:polymer-bundler_test.ts

示例10: _retrieveLatestVersion

  /**
   * Retrieves the latest AngularJS Material version remotely.
   */
  private static _retrieveLatestVersion(): string {
    try {
      return execSync('npm view angular-material version --silent').toString().trim();
    } catch (e) {
      Logger.error('Failed to retrieve latest version.');
      Logger.info(e.stack);
    }

    return '';
  }
开发者ID:angular,项目名称:material-tools,代码行数:13,代码来源:PackageResolver.ts

示例11: execSync

export let findChangedFiles = (refA?: string, refB?: string) => {
  if (refA === undefined) {
    refA = 'HEAD';
  }
  if (refB === undefined) {
    refB = '';
  }

  let output = execSync(`git diff --name-only --diff-filter=ACMR ${refA} ${refB}`, { encoding: 'utf8' });
  return output.split('\n').filter(fileName => fileName.length > 0);
};
开发者ID:AFASSoftware,项目名称:typescript-assistant,代码行数:11,代码来源:helpers.ts

示例12: execSync

export function execSync(command: string, execSyncOptions?: child_process.ExecSyncOptions, opts?: ISkipErrorComposition): any {
	try {
		return child_process.execSync(command, execSyncOptions);
	} catch (err) {
		if (opts && opts.skipError) {
			return err;
		} else {
			throw (new Error(`Error ${err.message} while executing ${command}.`));
		}
	}
}
开发者ID:telerik,项目名称:ios-sim-portable,代码行数:11,代码来源:child-process.ts

示例13: function

  run: function (options: any) {
    let versions: any = process.versions;
    const pkg = require(path.resolve(__dirname, '..', 'package.json'));
    let projPkg: any;
    try {
      projPkg = require(path.resolve(this.project.root, 'package.json'));
    } catch (exception) {
      projPkg = undefined;
    }

    versions.os = process.platform + ' ' + process.arch;

    const alwaysPrint = ['node', 'os'];
    const roots = ['@angular/', '@ngtools/'];

    let ngCliVersion = pkg.version;
    if (!__dirname.match(/node_modules/)) {
      let gitBranch = '??';
      try {
        const gitRefName = '' + child_process.execSync('git symbolic-ref HEAD', {cwd: __dirname});
        gitBranch = path.basename(gitRefName.replace('\n', ''));
      } catch (e) {
      }

      ngCliVersion = `local (v${pkg.version}, branch: ${gitBranch})`;
    }
    const config = CliConfig.fromProject();
    if (config && config.config && config.config.project) {
      if (config.config.project.ejected) {
        ngCliVersion += ' (e)';
      }
    }

    if (projPkg) {
      roots.forEach(root => {
        versions = Object.assign(versions, this.getDependencyVersions(projPkg, root));
      });
    }
    const asciiArt = `    _                      _                 ____ _     ___
   / \\   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \\ | '_ \\ / _\` | | | | |/ _\` | '__|   | |   | |    | |
 / ___ \\| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_|       \\____|_____|___|
               |___/`;
    this.ui.writeLine(chalk.red(asciiArt));
    this.printVersion('@angular/cli', ngCliVersion);

    for (const module of Object.keys(versions)) {
      const isRoot = roots.some(root => module.startsWith(root));
      if (options.verbose || alwaysPrint.indexOf(module) > -1 || isRoot) {
        this.printVersion(module, versions[module]);
      }
    }
  },
开发者ID:itslenny,项目名称:angular-cli,代码行数:54,代码来源:version.ts

示例14: main

async function main(quality: string): Promise<void> {
	const commit = execSync('git rev-parse HEAD', { encoding: 'utf8' }).trim();

	console.log(`Queueing signing request for '${quality}/${commit}'...`);
	await queueSigningRequest(quality, commit);

	console.log('Waiting on signed build...');
	await waitForSignedBuild(quality, commit);

	console.log('Found signed build!');
}
开发者ID:hungys,项目名称:vscode,代码行数:11,代码来源:enqueue.ts

示例15: expectFolderToMatchSnapshot

function expectFolderToMatchSnapshot(folder: string) {
  const absoluteFolder = path.resolve(path.join(__dirname, folder));
  const cwd = process.cwd();
  process.chdir(path.join(absoluteFolder, 'source'));
  execSync('node ../../../bin/texturer config.json');
  process.chdir(cwd);
  const calculatedHash = getHashFromBuffer(
    serializeFolderToBuffer(path.join(absoluteFolder, 'generated')),
  );
  expect(calculatedHash).toMatchSnapshot();
}
开发者ID:igor-bezkrovny,项目名称:texturer,代码行数:11,代码来源:snapshots.spec.ts


注:本文中的child_process.execSync函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。