Created
May 1, 2021 19:30
-
-
Save davidsharp/374f8c9dd6aa5ca095ca02cc06f03f9a to your computer and use it in GitHub Desktop.
(untested) interruptable node.js script for autorunning retropie on a raspberry pi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const child_process = require('child_process') | |
const readline = require('readline'); | |
let bootRP = true; | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}); | |
rl.question('Enter [x] to skip RetroPie boot (5 seconds): ', (answer) => { | |
if(/x/gi.test(answer)) { | |
bootRP = false; | |
console.log('Skipping RetroPie'); | |
} | |
rl.close(); | |
}); | |
setTimeout(()=>{ | |
if(bootRP){ | |
rl.close(); | |
console.log('Booting RetroPie'); | |
child_process.spawn('emulationstation', {stdio: 'inherit'}); | |
} | |
},5000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment