sindresorhus/grunt-shell

stdin should allow an option to hide password chars

Closed this issue · 1 comments

tc commented

I have a grunt task where the command is an external app which asks for a password stdin. If i run the external app on the command line, this app hides the password chars.

But if i run it from grunt-shell, the password chars show in plain text. Is there a way to hide the respect the external app's stdin policy?

        shell: {
            deployToDev: {
                command: "deploy xxx.com",
                options: { stdout: true, stderr: true, failOnError: true }
            },

You could use something like https://github.com/isaacs/read but too obscure to be supported in this task.

Keep in mind that grunt is just Node.js. You can use whatever module you like:

grunt.registerTask('password', function () {
  var done = this.async();
  var read = require('read');

  read(options, function () {
     // read prompt answer and do something
     done();
  });
});