How to use @ionic/utils-subprocess - 6 common examples

To help you get started, we’ve selected a few @ionic/utils-subprocess 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 ionic-team / ionic-cli / packages / ionic / src / lib / shell.ts View on Github external
async which(command: string, { PATH = process.env.PATH }: WhichOptions = {}): Promise {
    return which(command, { PATH: this.alterPath(PATH || '') });
  }
github ionic-team / ionic-cli / packages / ionic / src / lib / native-run.ts View on Github external
export async function findNativeRun(): Promise {
  try {
    return await which('native-run');
  } catch (e) {
    if (e.code !== 'ENOENT') {
      throw e;
    }
  }
}
github ionic-team / ionic-cli / packages / ionic / src / lib / utils / npm.ts View on Github external
export async function pkgFromRegistry(npmClient: NpmClient, options: Partial): Promise {
  const [ manager, ...managerArgs ] = await pkgManagerArgs(npmClient, { command: 'info', json: true, ...options });

  const cmd = new Subprocess(manager, managerArgs);
  const result = await cmd.output();

  if (result) {
    const json = JSON.parse(result);
    return manager === 'yarn' ? json.data : json;
  }
}
github ionic-team / ionic-cli / packages / ionic / src / lib / shell.ts View on Github external
async createSubprocess(command: string, args: readonly string[] = [], options: SubprocessOptions = {}): Promise {
    const cmdpath = await this.resolveCommandPath(command, options);
    const proc = new Subprocess(cmdpath, args, options);

    return proc;
  }
github ionic-team / ionic-cli / packages / ionic / src / lib / helper.ts View on Github external
export async function sendMessage({ config, ctx }: SendMessageDeps, msg: IPCMessage) {
  const dir = path.dirname(config.p);
  await mkdirp(dir);
  const fd = await open(path.resolve(dir, 'helper.log'), 'a');
  const p = fork(ctx.binPath, ['_', '--no-interactive'], { stdio: ['ignore', fd, fd, 'ipc'] });

  p.send(msg);
  p.disconnect();
  p.unref();
}
github ionic-team / ionic-cli / packages / @ionic / cli-framework / src / utils / ipc.ts View on Github external
start(): void {
    try {
      fs.accessSync(this.modulePath, fs.constants.R_OK);
    } catch (e) {
      debug('Error during access check: %O', e);
      throw new IPCError(`Module not accessible: ${this.modulePath}`);
    }

    const p = fork(this.modulePath, this.args, { stdio: ['ignore', 'ignore', 'ignore', 'ipc'] });
    debug('RPC subprocess forked %o', [this.modulePath, ...this.args]);

    this.rpc.start(p);
  }

@ionic/utils-subprocess

Subprocess utils for NodeJS

MIT
Latest version published 11 months ago

Package Health Score

77 / 100
Full package analysis

Similar packages