Guest User

Untitled

a guest
Dec 16th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. var fun = function() {
  2. console.log("rrrr");
  3. exec('CALL hai.exe', function(err, data) {
  4.  
  5. console.log(err)
  6. console.log(data.toString());
  7. });
  8. }
  9. fun();
  10.  
  11. var exec = require('child_process').execFile;
  12.  
  13. var fun =function(){
  14. console.log("fun() start");
  15. exec('HelloJithin.exe', function(err, data) {
  16. console.log(err)
  17. console.log(data.toString());
  18. });
  19. }
  20. fun();
  21.  
  22. var exec = require('child_process').execFile;
  23. /**
  24. * Function to execute exe
  25. * @param {string} fileName The name of the executable file to run.
  26. * @param {string[]} params List of string arguments.
  27. * @param {string} path Current working directory of the child process.
  28. */
  29. function execute(fileName, params, path) {
  30. let promise = new Promise((resolve, reject) => {
  31. exec(fileName, params, { cwd: path }, (err, data) => {
  32. if (err) reject(err);
  33. else resolve(data);
  34. });
  35.  
  36. });
  37. return promise;
  38. }
Add Comment
Please, Sign In to add comment