當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript execa類代碼示例

本文整理匯總了TypeScript中execa的典型用法代碼示例。如果您正苦於以下問題:TypeScript execa類的具體用法?TypeScript execa怎麽用?TypeScript execa使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了execa類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: async

async () => {
    const { stdout } = await execa('stdin', {
        input: 'hello',
        stdio: [null, 'ignore', null]
    });
    assert(stdout === null);
};
開發者ID:DanCorder,項目名稱:DefinitelyTyped,代碼行數:7,代碼來源:execa-tests.ts

示例2: async

const getSsim = async ({ toolName, imageName }: ISubject) => {
  const original = getPath({ toolName: 'photoshop', imageName });
  const optimised = getPath({ toolName, imageName });
  const { stdout } = await execa('pyssim', [original, optimised]);
  const ssim = parseFloat(stdout);
  return ssim;
};
開發者ID:JamieMason,項目名稱:image-optimisation-tools-comparison,代碼行數:7,代碼來源:update-results.ts

示例3: log

 .then(exists => {
   log('found %s ?', exePath, exists)
   if (!exists) {
     throw notInstalledErr(`Browser ${name} file not found at ${exePath}`)
   }
   // on Windows using "--version" seems to always start the full
   // browser, no matter what one does.
   const args: [string] = [
     'datafile',
     'where',
     `name="${doubleEscape(exePath)}"`,
     'get',
     'Version',
     '/value'
   ]
   return execa('wmic', args)
     .then(result => result.stdout)
     .then(trim)
     .then(tap(log))
     .then(getVersion)
     .then((version: string) => {
       log("browser %s at '%s' version %s", name, exePath, version)
       return {
         name,
         version,
         path: exePath
       }
     })
 })
開發者ID:lgandecki,項目名稱:cypress,代碼行數:29,代碼來源:index.ts

示例4: cache

const getLatLon = cache('latlon', async () => {
  debug('fetching lat/lon...')
  const { stdout } = await execa('whereami')
  let lines = stdout.split('\n')
  let lat = (lines.find(l => l.startsWith('Latitude:')) as string).split(': ')[1]
  let lon = (lines.find(l => l.startsWith('Longitude:')) as string).split(': ')[1]
  return { lat, lon }
})
開發者ID:dickeyxxx,項目名稱:tmux-weather,代碼行數:8,代碼來源:tmux-weather.ts

示例5: _spawn

// eslint-disable-next-line no-underscore-dangle
function _spawn(command, args, opts) {
	children += 1;

	const child = execa(command, args, opts);
	const drain = (code, signal) => {
		children -= 1;

		// don't run repeatedly if this is the error event
		if (signal === undefined) {
			child.removeListener('exit', drain);
		}
	};

	child.once('exit', drain);
	child.once('error', drain);

	return child;
}
開發者ID:sutarmin,項目名稱:dx-platform,代碼行數:19,代碼來源:child-process.utils.ts

示例6: getVersionString

export function getVersionString(path: string) {
  const doubleEscape = (s: string) => s.replace(/\\/g, '\\\\')

  // on Windows using "--version" seems to always start the full
  // browser, no matter what one does.

  const args = [
    'datafile',
    'where',
    `name="${doubleEscape(path)}"`,
    'get',
    'Version',
    '/value'
  ]

  return execa('wmic', args)
    .then(result => result.stdout)
    .then(trim)
}
開發者ID:YOU54F,項目名稱:cypress,代碼行數:19,代碼來源:index.ts

示例7: tsc

async function tsc(out, cwd, optModule, optTarget) {
  await fs.remove(out);
  return exec(
    'tsc',
    ['--module', optModule, '--outDir', out, '--target', optTarget],
    { cwd }
  )
    .catch(e => e)
    .then(r => r.stdout);
}
開發者ID:skatejs,項目名稱:skatejs,代碼行數:10,代碼來源:build.ts


注:本文中的execa類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。