Checkout
Stefan Sperling
committed
on 19 Dec 12
Add a new function to the cmdline library to determine whether standard
input is connected to a terminal device, and set the --non-interacti… Show more
Add a new function to the cmdline library to determine whether standard

input is connected to a terminal device, and set the --non-interactive

option if standard input is not connected to a terminal device.

The idea is to make 'svn' non-interactive by default if run from scripts

which are launched in some unattended automated fashion. In such a situation

it is possible for scripts to hang if 'svn' decides to prompt for information

such as login credentials or conflict resolution options.

Also add a new --force-interactive option which enforces the old behaviour.

* subversion/include/svn_cmdline.h

 (svn_cmdline__stdin_isatty): Declare.

* subversion/libsvn_subr/cmdline.c: Include io.h on Windows.

 (svn_cmdline__stdin_isatty): New.

* subversion/svn/cl.h

 (svn_cl__opt_state_t): Add force_interactive option.

* subversion/svn/svn.c

 (svn_cl__longopt_t): Add opt_force_interactive.

 (sub_main): Set the --non-interactive option based on whether stdin is a tty,

  unless interactive mode has been forced with --force-interactive.

  Enforce mutual exclusion of --non-interactive and --force-interactive.

* subversion/tests/cmdline/getopt_tests_data/svn_help_log_switch_stdout: Adjust.

* subversion/tests/cmdline/update_tests.py

 (eof_in_interactive_conflict_resolver): Pass --force-interactive to ensure

  the interactive conflict resolver will be run as expected.

Show less