view tests/test-mactext.t @ 35432:86b8cc1f244e

worker: make windows workers daemons The windows workers weren't daemons and were not correctly killed when ctrl-c'd from the terminal. Withi this change when the main thread is killed, all daemons get killed as well. I also reduced the time we give to workers to cleanup nicely to not have people ctrl-c'ing when they get inpatient. The output when threads clened up nicely: PS C:\<dir>> hg.exe sparse --disable-profile SparseProfiles/<profile>.sparse interrupted! The output when threads don't clenup in 1 sec: PS C:\<dir> hg.exe sparse --enable-profile SparseProfiles/<profile>.sparse failed to kill worker threads while handling an exception interrupted! Exception in thread Thread-4 (most likely raised during interpreter shutdown): PS C:\<dir>> Test Plan: Run hg command on windows (pull/update/sparse). Ctrl-C'd sparse --enable-profile command that was using threads and observed in proces explorer that all threads got killed. ran tests on CentOS Differential Revision: https://phab.mercurial-scm.org/D1564
author Wojciech Lis <wlis@fb.com>
date Thu, 30 Nov 2017 16:01:53 -0800
parents 75be14993fda
children adec6374a0b2
line wrap: on
line source


  $ cat > unix2mac.py <<EOF
  > import sys
  > 
  > for path in sys.argv[1:]:
  >     data = file(path, 'rb').read()
  >     data = data.replace('\n', '\r')
  >     file(path, 'wb').write(data)
  > EOF
  $ cat > print.py <<EOF
  > import sys
  > print(sys.stdin.read().replace('\n', '<LF>').replace('\r', '<CR>').replace('\0', '<NUL>'))
  > EOF
  $ hg init
  $ echo '[hooks]' >> .hg/hgrc
  $ echo 'pretxncommit.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
  $ echo 'pretxnchangegroup.cr = python:hgext.win32text.forbidcr' >> .hg/hgrc
  $ cat .hg/hgrc
  [hooks]
  pretxncommit.cr = python:hgext.win32text.forbidcr
  pretxnchangegroup.cr = python:hgext.win32text.forbidcr

  $ echo hello > f
  $ hg add f
  $ hg ci -m 1

  $ $PYTHON unix2mac.py f
  $ hg ci -m 2
  attempt to commit or push text file(s) using CR line endings
  in dea860dc51ec: f
  transaction abort!
  rollback completed
  abort: pretxncommit.cr hook failed
  [255]
  $ hg cat f | $PYTHON print.py
  hello<LF>
  $ cat f | $PYTHON print.py
  hello<CR>