All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [bitbake-devel] [PATCH 1/3] server/process/daemonize: Use sys.exit(), not os._exit() for server
       [not found] <162D9CC75E66F9C7.7353@lists.openembedded.org>
@ 2020-08-24  8:01 ` Richard Purdie
  0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2020-08-24  8:01 UTC (permalink / raw)
  To: bitbake-devel

On Sat, 2020-08-22 at 15:16 +0100, Richard Purdie via lists.openembedded.org wrote:
> By using os._exit() in the server, we confuse python programmers no end
> since atexit calls, along with threading cleanup calls are skipped. We're
> careful about the environment the server is created within so we should
> be able to use sys.exit() here and have things behave as the python devs
> intend.
> 
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  lib/bb/daemonize.py      | 4 +---
>  lib/bb/server/process.py | 1 +
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/bb/daemonize.py b/lib/bb/daemonize.py
> index f01e6ec7cc..0ec5ef3986 100644
> --- a/lib/bb/daemonize.py
> +++ b/lib/bb/daemonize.py
> @@ -89,9 +89,7 @@ def createDaemon(function, logfile):
>          traceback.print_exc()
>      finally:
>          bb.event.print_ui_queue()
> -        # os._exit() doesn't flush open files like os.exit() does. Manually flush
> -        # stdout and stderr so that any logging output will be seen, particularly
> +        # Manually flush stdout and stderr so that any logging output will be seen, particularly
>          # exception tracebacks.
>          sys.stdout.flush()
>          sys.stderr.flush()
> -        os._exit(0)
> diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
> index 65e1eab527..b03d64391b 100644
> --- a/lib/bb/server/process.py
> +++ b/lib/bb/server/process.py
> @@ -492,6 +492,7 @@ class BitBakeServer(object):
>              # Flush any ,essages/errors to the logfile before exit
>              sys.stdout.flush()
>              sys.stderr.flush()
> +        sys.exit(0)
>  
>  def connectProcessServer(sockname, featureset):
>      # Connect to socket

For the archives, we can't merge this since it allows SystemExit to be
seen in the parent process, e.g. the selftests when under unittest.

Cheers,

Richard


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-24  8:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <162D9CC75E66F9C7.7353@lists.openembedded.org>
2020-08-24  8:01 ` [bitbake-devel] [PATCH 1/3] server/process/daemonize: Use sys.exit(), not os._exit() for server Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.