sapling/tests/test-errorredirect.t
Laurent Charignon 0ca941a08a cleanup: use backtick instead of parent to capture output of shell cmd
Summary: This diff is part of a series to cleanup fb-hgext and make it pass check-code.

Test Plan: all tests pass

Reviewers: #sourcecontrol, ttung, mitrandir, akushner

Reviewed By: akushner

Subscribers: mpm, akushner, mitrandir

Differential Revision: https://phabricator.fb.com/D2811997

Signature: t1:2811997:1452200059:9e4fca501a22f95d2d9a22d234758f55e292ea9a
2016-01-07 18:30:24 -08:00

26 lines
730 B
Perl

$ extpath=`dirname $TESTDIR`
$ cp $extpath/errorredirect.py $TESTTMP
$ cat > $TESTTMP/crash.py << EOF
> from mercurial import cmdutil
> cmdtable = {}
> command = cmdutil.command(cmdtable)
> @command('crash', [])
> def crash(ui, repo):
> raise 'crash'
> EOF
$ cat >> $HGRCPATH << EOF
> [extensions]
> errorredirect=$TESTTMP/errorredirect.py
> crash=$TESTTMP/crash.py
> EOF
Test errorredirect will respect original behavior by default
$ hg init
$ hg crash 2>&1 | grep -o 'Unknown exception encountered'
Unknown exception encountered
Test the errorredirect script will override stack trace output
$ hg crash --config errorredirect.script='echo overrided-message'
overrided-message
[1]