Operating System - HP-UX
1753795 Members
6813 Online
108799 Solutions
New Discussion юеВ

Re: Scripting issue where it wants a tty

 
A. Clay Stephenson
Acclaimed Contributor

Re: Scripting issue where it wants a tty

Hi Again:

Oops, I'm stupid, I meant to say so that isatty(0) returns a non-0 result.

Clay
If it ain't broke, I can fix that.
Carlos Fernandez Riera
Honored Contributor

Re: Scripting issue where it wants a tty

Redirection of standars file is an old trick.

I dont like to use /dev/console ( it could interact with syslogd). But i had do it some times using /dev/tty0p1 or similars.

New tecnichs is the use of a x-terminal device instead. You can open a window and just redirect to that /dev/... pts?
unsupported
Volker Borowski
Honored Contributor

Re: Scripting issue where it wants a tty

Hmm,

"it is a 3rd party binary".

Well I would expect a real binary to speak clearly to me if something is wrong, if it is well coded.
Conclusion: The message does NOT come from the program, but the program calls an operatingsystem-command via c-call "system" or so (stty, tset ....)
If you are lucky, "strings programname" gives you a clue what it is calling. May be you can patch this name with a hexeditor to call a program of yours, that does what the program needs, but fakes the tty flags....

No idea if this helps.
Volker

Bernie Vande Griend
Respected Contributor

Re: Scripting issue where it wants a tty

Carlos, I know redirection is an old trick, but how do I do it? Redirecting the output doesn't help, are you talking about something else? I don't think an xterminal device would work either.
Volker: "if it is well coded". That's a good one. The code needs help which the vendor admitted. strings actually shows that "Not a tty" is inside the binary, that means they're doing their own checking. I see no external calls to other programs either.
Clay, you're on the right track. I don't have time or patience for plan B. I have gotten this to work using expect. I have to make my code much more complex for my issue, but this is probably the route I'll take. Thank you all for your help.
Ye who thinks he has a lot to say, probably shouldn't.
Carlos Fernandez Riera
Honored Contributor

Re: Scripting issue where it wants a tty

Sorry ... sorry

Standard files:

standard-input file_despcriptor 0
standard-output file_despcriptor 1
standard-error file_despcriptor 2


my_program 0/dev/tty0p1 2>&1


unsupported
Bernie Vande Griend
Respected Contributor

Re: Scripting issue where it wants a tty

Thanks Carlos, that's what I was looking for. I was just brain-dead big time on that one. Unfortunately it doesn't solve my problem, as redirecting input doesn't allow me to automatically enter my own input. Thus Clay's plan B above, would be the solution to have specially pseudo driver that handled this. However, I'm going to use expect to take care of this problem. No need for more responses. Thanks all.
Ye who thinks he has a lot to say, probably shouldn't.
Kohnke
New Member

Re: Scripting issue where it wants a tty

The problem is the (s)tty setting in the profile.

To get rid of this problem:

if tty -s
then
PS1=.....
fi
All the tty related stuff should between then .. fi.

This should solve the problem.


Peter.
There's always a solution
Bernie Vande Griend
Respected Contributor

Re: Scripting issue where it wants a tty

used expect to interact with the binary
Ye who thinks he has a lot to say, probably shouldn't.