test.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. function t(msg) {
  2. print('\n=== '+msg+ ' ===')
  3. }
  4. //t ("Test: mpg123 & ");
  5. //var result = popen('mpg123 --loop -1 SampleAudio_0.7mb.mp3 &');
  6. //print ("JS " + result);
  7. /*
  8. t ("Test: top & ");
  9. var result = system('top &');
  10. print ("JS " + result);*/
  11. t ("Test: nonblock1");
  12. var result1 = launchProcess('sleep 25');
  13. print("JS " + result1);
  14. t ("Test: nonblock2");
  15. var result2 = launchProcess('sleep 10');
  16. print("JS " + result2);
  17. t ("Test: nonblock3");
  18. var result3 = launchProcess('sleep 15');
  19. print("JS " + result3);
  20. t ("Test: nonblock4");
  21. var result4 = launchProcess('sleep 15');
  22. print("JS " + result4);
  23. t ("Test: nonblock5");
  24. var result5 = launchProcess('sleep 15');
  25. print("JS " + result5);
  26. t ("Test: nonblock6");
  27. var result6 = launchProcess('sleep 15');
  28. print("JS " + result6);
  29. t ("Test: check proc");
  30. var ju = checkProcess(result5);
  31. print("JS " + ju);
  32. //sleep(10);
  33. t ("Test: kill " + result1);
  34. var resultk1 = killProcess(result1);
  35. //var result = nonblock(result);
  36. print("JS " + resultk1);
  37. t ("Test: kill " + result3);
  38. var resultk1 = killProcess(result3);
  39. //var result = nonblock(result);
  40. print("JS " + resultk1);
  41. sleep(3);
  42. t ("Test: nonblock7");
  43. var result7 = launchProcess('sleep 15');
  44. print("JS " + result7);
  45. t ("Test: nonblock8");
  46. var result8 = launchProcess('sleep 15');
  47. print("JS " + result8);
  48. sleep(5);
  49. t ("Test: nonblock9");
  50. var result9 = launchProcess('sleep 15');
  51. print("JS " + result9);
  52. t ("Test: check proc");
  53. var juc = checkProcess('43111');
  54. print("JS " + juc);
  55. t("Test: end 0");
  56. result5 = launchProcess('end 0');
  57. print("JS5 " + result5);
  58. /* t ("Test: nonblock1");
  59. var result = nonblock('top');
  60. print("JS " + result);
  61. */
  62. //t ("Test: top & echo $!");
  63. //var result = popen('top & echo $!');
  64. //print ("JS " + result);
  65. /*
  66. t ("Test: echo !$");
  67. var result = popen('echo !$');
  68. print ("JS " + result);*/
  69. /*
  70. t ("Test: cat non existing file");
  71. var result = popen('cat jublje.txt');
  72. print ("JS " + result);
  73. */