How to use the get-bin-path.getBinPathSync function in get-bin-path

To help you get started, we’ve selected a few get-bin-path examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ehmicky / nve / test / path.js View on Github external
import { platform } from 'process'
import { normalize } from 'path'

import test from 'ava'
import { each } from 'test-each'
import { getBinPathSync } from 'get-bin-path'
import execa from 'execa'
import isCi from 'is-ci'
import pathKey from 'path-key'

import nvexeca from '../src/main.js'

import { HELPER_VERSION, TEST_VERSION } from './helpers/versions.js'

const FORK_FILE = normalize(`${__dirname}/helpers/fork.js`)
const BIN_PATH = getBinPathSync()

// Those tests do not work in Travis CI with Windows.
// However they work on Windows locally.
// TODO: figure out why those tests are failing on CI.
// This will probably be fixed once nyc@15 is released.
// See https://github.com/istanbuljs/spawn-wrap/issues/108
if (platform !== 'win32' || !isCi) {
  each(
    [
      ['node', '--version'],
      ['node', FORK_FILE, 'node', '--version'],
      ['node', BIN_PATH, HELPER_VERSION, 'node', '--version'],
    ],
    [{}, { [pathKey()]: undefined }],
    ({ title }, args, env) => {
      test(`Works with child processes | ${title}`, async t => {
github ehmicky / nve / benchmarks / main.js View on Github external
import { execFile } from 'child_process'
import { promisify } from 'util'

import { getBinPathSync } from 'get-bin-path'

const NVE_PATH = getBinPathSync()

const pExecFile = promisify(execFile)

const VERSION = '6.0.0'

// This must be substracted from the time taken by any of the following tasks
export const nodeVersion = {
  title: 'node --version',
  async main() {
    await pExecFile('node', ['--version'])
  },
}

// This must be substracted from the time taken by nvm
export const bash = async function() {
  await pExecFile('bash', ['-i', '-c', ''])

get-bin-path

Get the current package's binary path

Apache-2.0
Latest version published 9 months ago

Package Health Score

61 / 100
Full package analysis