Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

launcher.js 1.0KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/env node
  2. const ChildProcess = require('child_process');
  3. let executablePath = null;
  4. const appArgs = [];
  5. const chromeArgs = [];
  6. process.argv.slice(2).forEach(function (arg) {
  7. const indexOfEqualSign = arg.indexOf('=');
  8. if (indexOfEqualSign === -1) {
  9. chromeArgs.push(arg);
  10. return;
  11. }
  12. const name = arg.substring(0, indexOfEqualSign);
  13. const value = arg.substring(indexOfEqualSign + 1);
  14. if (name === '--spectron-path') {
  15. executablePath = value;
  16. } else if (name.indexOf('--spectron-arg') === 0) {
  17. appArgs[Number(name.substring(14))] = value;
  18. } else if (name.indexOf('--spectron-env') === 0) {
  19. process.env[name.substring(15)] = value;
  20. } else if (name.indexOf('--spectron-') !== 0) {
  21. chromeArgs.push(arg);
  22. }
  23. });
  24. const args = appArgs.concat(chromeArgs);
  25. const appProcess = ChildProcess.spawn(executablePath, args);
  26. appProcess.on('exit', function (code) {
  27. process.exit(code);
  28. });
  29. appProcess.stderr.pipe(process.stdout);
  30. appProcess.stdout.pipe(process.stdout);
  31. appProcess.stdin.pipe(process.stdin);