Skip to content

Commit

Permalink
Added worked route for user revoking
Browse files Browse the repository at this point in the history
  • Loading branch information
KIRIL-RA committed Jul 29, 2024
1 parent 4f90706 commit ea2c1c0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions classes/Process.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const PROCESS_STATUSES = {
IN_PROGRESS: "progress"
}

function RunProcess(scriptPath, args, isNeedConfirmation=false) {
function RunProcess(scriptPath, args, isNeedConfirmation = false) {
return new Promise((resolve, reject) => {
let status = PROCESS_STATUSES.IN_PROGRESS;

Expand All @@ -22,6 +22,13 @@ function RunProcess(scriptPath, args, isNeedConfirmation=false) {

// Listen for script's request for input
child.stdout.on('data', (data) => {
if (isNeedConfirmation) {
// Check if the output contains "Y/n" and respond with 'y'
if (data.toString().includes('[y/N]')) {
child.stdin.write('y');
child.stdin.end()
}
}
console.log(`Script stdout: ${data}`);
});

Expand All @@ -36,4 +43,4 @@ function RunProcess(scriptPath, args, isNeedConfirmation=false) {
});
}

module.exports = {RunProcess};
module.exports = { RunProcess };

0 comments on commit ea2c1c0

Please sign in to comment.