Re: [go-nuts] is running interactive or not

2023-06-10 Thread Robert Engels
No need to even think about this. Look at ssh and mimic their practices. It has been thoroughly audited. > On Jun 10, 2023, at 5:35 AM, quin...@gmail.com wrote: > > there has been much discussion in the past about programs that modify their > behaviour depending on what stdout is; > http://

Re: [go-nuts] is running interactive or not

2023-06-10 Thread quin...@gmail.com
there has been much discussion in the past about programs that modify their behaviour depending on what stdout is; http://harmful.cat-v.org/cat-v/unix_prog_design.pdf i do to want to start a war, just suggest a different approach is available. my suggestion would be to always expect a password

Re: [go-nuts] is running interactive or not

2023-06-08 Thread Rich
Thank you Cris and Kurtis -- For this project I am going with the switch option -- but I have other programs that I am going to replace the os.Getpid and os.Getppid trick with go-isatty. On Thursday, June 8, 2023 at 3:22:29 PM UTC-4 Chris Burkert wrote: > Hi, there are cases when this does no

Re: [go-nuts] is running interactive or not

2023-06-08 Thread Chris Burkert
Hi, there are cases when this does not work. I tend to use a flag like -batch or -noninteractive to trigger the correct behavior from within scripts. Less magic, more control. Rich schrieb am Do. 8. Juni 2023 um 20:19: > Hi, > > I have a program I am writing that stops and asks the user for inpu

Re: [go-nuts] is running interactive or not

2023-06-08 Thread Kurtis Rader
The easiest way to detect if your program is running interactively is to use https://github.com/mattn/go-isatty and test if stdin (fd 0) is connected to a terminal. The Elvish shell uses this function to handle both Unix and Windows: // IsATTY determines whether the given file is a terminal. func

[go-nuts] is running interactive or not

2023-06-08 Thread Rich
Hi, I have a program I am writing that stops and asks the user for input, in this case it's a passphrase used to encrypt output. I want the program to also be able to be used in a script, and if in a script use a predefined value as the passphrase. What I'd like to know is how to detect if r