Part of this program checks if java is installed and continues checking every two seconds, then proceeds once it's installed, how do i make it update the terminal context to be able to execute the java command without restarting the program itself?
var javaCheckLoop = setInterval(function(){
checkJava(function(res){
if(res){
//java installed, continue
} else {
//java not found, keep checking
}
})
},2000)
function checkJava(callback) {
//need terminal context to update so it can detect java
var c = require('child_process').exec('java', (error, stdout, stderr) => {
callback(stderr.includes("Usage")); //returns true if java is available via cmd
});
};