Skip to content

Instantly share code, notes, and snippets.

@davidsharp
Created May 1, 2021 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidsharp/374f8c9dd6aa5ca095ca02cc06f03f9a to your computer and use it in GitHub Desktop.
Save davidsharp/374f8c9dd6aa5ca095ca02cc06f03f9a to your computer and use it in GitHub Desktop.
(untested) interruptable node.js script for autorunning retropie on a raspberry pi
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