Advertisement
Guest User

Untitled

a guest
May 19th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. async function execProcess(command, input) {
  2. const options = { timeout: 5000, maxBuffer: 50 * 1024 * 1024 };
  3.  
  4. return new Promise((resolve, reject) => {
  5. const proc = child_process.exec(command, options, (error, stdout, stderr) => {
  6. resolve({ stdout, stderr });
  7. });
  8.  
  9. if (input) {
  10. proc.stdin.write(input, () => {
  11. proc.stdin.end();
  12. });
  13. }
  14. });
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement