How to allow prompting for password?
kykungz opened this issue · 3 comments
kykungz commented
I used listr
to execute commands with execa, which some of commands required sudo
permission which asks for password.
However, it seems like the loading state of listr
task is overriding my password prompts, giving no feedback to users to type in the password. Although I can still type in the password and press Enter, it is hard to determine that they are prompting for password.
Any solution?
Nasseratic commented
seams no more maintainers here 😞
LitoMore commented
Could you make a case for me then I can work on it?
mehdi-sh-hm commented
You can do something like this but if you change one thing in source code of project 😐
import { UpdateRenderer, render /** This is the change I was talking about */ } from 'listr-update-renderer'
/* Some state management to export to change the state */
export const RenderState = {
pause: false
}
export class MyRenderer extends UpdateRenderer {
_id;
_tasks;
_options;
render() {
if (this._id) {
// Do not render if we are already rendering
return;
}
this._id = setInterval(() => {
if (RenderState.pause) {
return
}
render(this._tasks, this._options);
}, 100);
}
}
then you can do something like this in your task
task: async (ctx, task) => {
RenderState.pause = true;
await cli.confirm('Are you sure?')
RenderState.pause = false;
}
💥