How to use the web-ext-native-msg.ChildProcess function in web-ext-native-msg

To help you get started, we’ve selected a few web-ext-native-msg 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 asamuzaK / withExEditorHost / modules / main.js View on Github external
args = new CmdArgs(cmdArgs).toArray();
  }
  if (hasPlaceholder) {
    const [filePath] = new CmdArgs(quoteArg(file)).toArray();
    const reg =
      new RegExp(`\\$(?:${TMP_FILE_PLACEHOLDER}|{${TMP_FILE_PLACEHOLDER}})`);
    const l = args.length;
    let i = 0;
    while (i < l) {
      const arg = args[i];
      reg.test(arg) && args.splice(i, 1, arg.replace(reg, filePath));
      i++;
    }
    proc = await new ChildProcess(app, args, opt).spawn();
  } else {
    proc = await new ChildProcess(app, args, opt).spawn(file);
  }
  proc.on("error", handleChildProcessErr);
  proc.stderr.on("data", handleChildProcessStderr);
  proc.stdout.on("data", handleChildProcessStdout);
  return proc;
};
github asamuzaK / withExEditorHost / modules / main.js View on Github external
args = cmdArgs.slice();
  } else {
    args = new CmdArgs(cmdArgs).toArray();
  }
  if (hasPlaceholder) {
    const [filePath] = new CmdArgs(quoteArg(file)).toArray();
    const reg =
      new RegExp(`\\$(?:${TMP_FILE_PLACEHOLDER}|{${TMP_FILE_PLACEHOLDER}})`);
    const l = args.length;
    let i = 0;
    while (i < l) {
      const arg = args[i];
      reg.test(arg) && args.splice(i, 1, arg.replace(reg, filePath));
      i++;
    }
    proc = await new ChildProcess(app, args, opt).spawn();
  } else {
    proc = await new ChildProcess(app, args, opt).spawn(file);
  }
  proc.on("error", handleChildProcessErr);
  proc.stderr.on("data", handleChildProcessStderr);
  proc.stdout.on("data", handleChildProcessStdout);
  return proc;
};