What's the issue? Getting a ENOTTY error on a function call tcgetattr() when the process is invoked from a script. The error comes only when ran from the script. If it is run from an interactive shell, it works fine.
What exactly is process doing ? The process is trying to turn off the canonical processing of input from stdin. This is required because the inputs may be coming in bursts and may hog the input queue. For this the process gets the terminal file descriptor parameters for stdin using tcgetattr() function. and then turns off the canonical flag in termios struct.
Reason for error ? When a script is invoked it runs in non interactive mode, which means there is no tty attached and hence it is not available to the process invoked from the script. That's why the process is returning ENOTTY.
Looking for ? Workaround to still be able to invoke the process from script without any changes in program ? (Tried forcing interactive shell using -i in script, not working!!!)