858 $ get-with-headers.py localhost:$HGPORT '?style=.../.../' |
858 $ get-with-headers.py localhost:$HGPORT '?style=.../.../' |
859 200 Script output follows |
859 200 Script output follows |
860 |
860 |
861 fall back to default |
861 fall back to default |
862 |
862 |
|
863 $ killdaemons.py |
|
864 |
|
865 Test signal-safe-lock in web and non-web processes |
|
866 |
|
867 $ cat <<'EOF' > disablesig.py |
|
868 > import signal |
|
869 > from mercurial import error, extensions |
|
870 > def disabledsig(orig, signalnum, handler): |
|
871 > if signalnum == signal.SIGTERM: |
|
872 > raise error.Abort(b'SIGTERM cannot be replaced') |
|
873 > try: |
|
874 > return orig(signalnum, handler) |
|
875 > except ValueError: |
|
876 > raise error.Abort(b'signal.signal() called in thread?') |
|
877 > def uisetup(ui): |
|
878 > extensions.wrapfunction(signal, b'signal', disabledsig) |
|
879 > EOF |
|
880 |
|
881 by default, signal interrupt should be disabled while making a lock file |
|
882 |
|
883 $ hg debuglock -s --config extensions.disablesig=disablesig.py |
|
884 abort: SIGTERM cannot be replaced |
|
885 [255] |
|
886 |
|
887 but in hgweb, it isn't disabled since some WSGI servers complains about |
|
888 unsupported signal.signal() calls (see issue5889) |
|
889 |
|
890 $ hg serve --config extensions.disablesig=disablesig.py \ |
|
891 > --config web.allow-push='*' --config web.push_ssl=False \ |
|
892 > -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
|
893 $ cat hg.pid >> $DAEMON_PIDS |
|
894 |
|
895 $ hg clone -q http://localhost:$HGPORT/ repo |
|
896 $ hg bookmark -R repo foo |
|
897 |
|
898 push would fail if signal.signal() were called |
|
899 |
|
900 $ hg push -R repo -B foo |
|
901 pushing to http://localhost:$HGPORT/ |
|
902 searching for changes |
|
903 no changes found |
|
904 exporting bookmark foo |
|
905 [1] |
|
906 |
|
907 $ rm -R repo |
|
908 $ killdaemons.py |
|
909 |
863 errors |
910 errors |
864 |
911 |
865 $ cat errors.log |
912 $ cat errors.log |
866 |
913 |
867 Uncaught exceptions result in a logged error and canned HTTP response |
914 Uncaught exceptions result in a logged error and canned HTTP response |
868 |
915 |
869 $ killdaemons.py |
|
870 $ hg serve --config extensions.hgweberror=$TESTDIR/hgweberror.py -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
916 $ hg serve --config extensions.hgweberror=$TESTDIR/hgweberror.py -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log |
871 $ cat hg.pid >> $DAEMON_PIDS |
917 $ cat hg.pid >> $DAEMON_PIDS |
872 |
918 |
873 $ get-with-headers.py localhost:$HGPORT 'raiseerror' transfer-encoding content-type |
919 $ get-with-headers.py localhost:$HGPORT 'raiseerror' transfer-encoding content-type |
874 500 Internal Server Error |
920 500 Internal Server Error |