Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r67814:fb3b41cc383a Date: 2013-11-03 19:50 +0100 http://bitbucket.org/pypy/pypy/changeset/fb3b41cc383a/
Log: Add a debug_flush() just before calling _exit(). Otherwise the log file is left incomplete. diff --git a/rpython/rtyper/module/ll_os.py b/rpython/rtyper/module/ll_os.py --- a/rpython/rtyper/module/ll_os.py +++ b/rpython/rtyper/module/ll_os.py @@ -1641,9 +1641,11 @@ @registering(os._exit) def register_os__exit(self): + from rpython.rlib import debug os__exit = self.llexternal('_exit', [rffi.INT], lltype.Void) def _exit_llimpl(status): + debug.debug_flush() os__exit(rffi.cast(rffi.INT, status)) return extdef([int], s_None, llimpl=_exit_llimpl, diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py --- a/rpython/translator/c/test/test_standalone.py +++ b/rpython/translator/c/test/test_standalone.py @@ -499,6 +499,21 @@ assert 'foo}' in lines[2] assert len(lines) == 3 + def test_debug_flush_at_exit(self): + def entry_point(argv): + debug_start("mycat") + os._exit(0) + return 0 + + t, cbuilder = self.compile(entry_point) + path = udir.join('test_debug_flush_at_exit.log') + cbuilder.cmdexec("", env={'PYPYLOG': ':%s' % path}) + # + f = open(str(path), 'r') + lines = f.readlines() + f.close() + assert lines[0].endswith('{mycat\n') + def test_fatal_error(self): def g(x): if x == 1: _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit