Created
July 31, 2020 10:51
-
-
Save Streeterxs/70b643169901e806b0b51debc2131962 to your computer and use it in GitHub Desktop.
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 readline = require('readline'); | |
const childProcess = require('child_process'); | |
const readlineInterface = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}); | |
readlineInterface.question(`Digite o nome do projeto que queira abrir: \n`, (input) => { | |
const visualCodeProject = childProcess.exec('code .', {cwd: `C:/Users/Afons/Projetos/${input}`}); | |
visualCodeProject.stderr.on('data', (data) => { | |
console.log('data: ', data); | |
}); | |
visualCodeProject.stdout.on('error', (error) => { | |
console.log('error: ', error); | |
}) | |
visualCodeProject.on('close', () => { | |
readlineInterface.close(); | |
}); | |
}); | |
readlineInterface.on('close', () => { | |
setTimeout(() => { | |
process.exit(); | |
}, 10000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment