4 replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
source | link

I'm investigating the behaviour of a script that is normally run as an automated process (e.g. cron, Jenkins). The script can (eventually) invoke commands that behave differently (seeking user input) when run interactively; for example, patch will ask what to do with a reversed patch, and svn will ask for passwords, but I need to see what happens when they're run non-interactively.

Persuading patch that it's non-interactive is fairly easy; I just need to redirect stdout to be a non-tty:

$ </dev/null > >(cat) /path/to/myscript --args

However svn will connect to the controlling terminal if it exists; editing the scripts to pass --non-interactive isn't really an option as this is coming from several levels deep and it'd be difficult to be certain I'd found every invocation.

Is there a way to invoke a script/command non-interactively, without a controlling terminal (so that /dev/tty doesn't exist)? I'd prefer stdout/stderr to still go to my terminal.

(I found the question http://unix.stackexchange.com/questions/23892/run-script-in-a-non-interactive-shellRun script in a non interactive shell? but the answers to that discuss the differences between the cron and user environment; I've already eliminated all differences except non-interactivity.)

I'm investigating the behaviour of a script that is normally run as an automated process (e.g. cron, Jenkins). The script can (eventually) invoke commands that behave differently (seeking user input) when run interactively; for example, patch will ask what to do with a reversed patch, and svn will ask for passwords, but I need to see what happens when they're run non-interactively.

Persuading patch that it's non-interactive is fairly easy; I just need to redirect stdout to be a non-tty:

$ </dev/null > >(cat) /path/to/myscript --args

However svn will connect to the controlling terminal if it exists; editing the scripts to pass --non-interactive isn't really an option as this is coming from several levels deep and it'd be difficult to be certain I'd found every invocation.

Is there a way to invoke a script/command non-interactively, without a controlling terminal (so that /dev/tty doesn't exist)? I'd prefer stdout/stderr to still go to my terminal.

(I found the question http://unix.stackexchange.com/questions/23892/run-script-in-a-non-interactive-shell but the answers to that discuss the differences between the cron and user environment; I've already eliminated all differences except non-interactivity.)

I'm investigating the behaviour of a script that is normally run as an automated process (e.g. cron, Jenkins). The script can (eventually) invoke commands that behave differently (seeking user input) when run interactively; for example, patch will ask what to do with a reversed patch, and svn will ask for passwords, but I need to see what happens when they're run non-interactively.

Persuading patch that it's non-interactive is fairly easy; I just need to redirect stdout to be a non-tty:

$ </dev/null > >(cat) /path/to/myscript --args

However svn will connect to the controlling terminal if it exists; editing the scripts to pass --non-interactive isn't really an option as this is coming from several levels deep and it'd be difficult to be certain I'd found every invocation.

Is there a way to invoke a script/command non-interactively, without a controlling terminal (so that /dev/tty doesn't exist)? I'd prefer stdout/stderr to still go to my terminal.

(I found the question Run script in a non interactive shell? but the answers to that discuss the differences between the cron and user environment; I've already eliminated all differences except non-interactivity.)

3 add tag for controlling terminal
| link
2 edited tags
| link
1
source | link