# Highline: Can I "ask" to STDERR

**URL:** <https://www.ruby-forum.com/t/highline-can-i-ask-to-stderr/150202>\
**Category:** Ruby\
**Created:** [October 6, 2008, 1:05am UTC](https://www.ruby-forum.com/t/highline-can-i-ask-to-stderr/150202 "2008-10-06T01:05:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpettet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jpettet](https://www.ruby-forum.com/u/jpettet)\
**Post date:** [October 6, 2008, 1:05am UTC](https://www.ruby-forum.com/t/highline-can-i-ask-to-stderr/150202/1 "2008-10-06T01:05:34Z")

</div>

Hello, fellow ruby enthusiasts! I’m a first time caller, long time  
listener.

Does highline allow you to send the “ask” prompt to STDERR? I often  
times use it to prompt for passwords in command line tools that I want  
to pipe to less or more. The problem is that if I pipe it to less or  
more I never see the password prompt, and I believe the usual workaround  
is to send the password prompt to STDERR to get around this.

Any ideas?

- Thanks!

---

<div class="post-metadata">

**Author:** ![jpettet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jpettet](https://www.ruby-forum.com/u/jpettet)\
**Post date:** [October 6, 2008, 4:22am UTC](https://www.ruby-forum.com/t/highline-can-i-ask-to-stderr/150202/2 "2008-10-06T04:22:58Z")

</div>

On Oct 5, 2008, at 6:03 PM, Jeremy Pruitt wrote:

> Hello, fellow ruby enthusiasts! I’m a first time caller, long time  
> listener.

Glad you decided to join us.

> Does highline allow you to send the “ask” prompt to STDERR?

Sure. If using the import interface, you can do it like this:

$terminal = HighLine.new($stdin, $stderr)  
ask( … )

Otherwise, you can just build the proper HighLine instance and use it:

hl = HighLine.new($stdin, $stderr)  
hl.ask( … )

Hope that helps.

James Edward G. II

---

<div class="post-metadata">

**Author:** ![jpettet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jpettet](https://www.ruby-forum.com/u/jpettet)\
**Post date:** [October 6, 2008, 4:37am UTC](https://www.ruby-forum.com/t/highline-can-i-ask-to-stderr/150202/3 "2008-10-06T04:37:15Z")

</div>

Perfect, thank you so much!

---

<div class="post-metadata">

**Author:** ![jpettet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jpettet](https://www.ruby-forum.com/u/jpettet)\
**Post date:** [October 13, 2008, 1:11am UTC](https://www.ruby-forum.com/t/highline-can-i-ask-to-stderr/150202/4 "2008-10-13T01:11:41Z")

</div>

On Sun, 05 Oct 2008 21:35:29 -0500, Jeremy Pruitt wrote:

> Perfect, thank you so much!

By the way, a little known Linux trick is that if you can read from  
stderr too. So if you want to have an interactive filter in a pipeline,  
that reads from stdin and writes to stdout, you can have it do all of  
it’s interaction (both ways) on stderr to read from the terminal.

That’s how `vim -’ works

–Ken
