How to use the which.default function in which

To help you get started, we’ve selected a few which 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 facebook / flipper / src / chrome / DevicesButton.tsx View on Github external
launchEmulator = (name: string) => {
    // On Linux, you must run the emulator from the directory it's in because
    // reasons ...
    which('emulator')
      .then(emulatorPath => {
        if (emulatorPath) {
          const child = spawn(emulatorPath, [`@${name}`], {
            detached: true,
            cwd: dirname(emulatorPath),
          });
          child.stderr.on('data', data => {
            console.error(`Android emulator error: ${data}`);
          });
          child.on('error', console.error);
        } else {
          throw new Error('Could not get emulator path');
        }
      })
      .catch(console.error);
    this.props.preferDevice(name);
github facebook / flipper / src / chrome / DevicesButton.tsx View on Github external
launchEmulator = (name: string) => {
    // On Linux, you must run the emulator from the directory it's in because
    // reasons ...
    which('emulator')
      .then(emulatorPath => {
        if (emulatorPath) {
          const child = spawn(emulatorPath, [`@${name}`], {
            detached: true,
            cwd: dirname(emulatorPath),
          });
          child.stderr.on('data', data => {
            console.error(`Android emulator error: ${data}`);
          });
          child.on('error', console.error);
        } else {
          throw new Error('Could not get emulator path');
        }
      })
      .catch(console.error);
    this.props.preferDevice(name);

which

Like which(1) unix command. Find the first instance of an executable in the PATH.

ISC
Latest version published 11 months ago

Package Health Score

91 / 100
Full package analysis