mirror of https://github.com/zulip/zulip.git
webpack: Close potential race condition leaking webpack-dev-server process.
This exchanges a race condition where webpack-dev-server might not be stopped on a poorly timed KeyboardInterrupt for a less bad race condition where we might get an UnboundLocalError. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
parent
cf921d5981
commit
faa4cf629a
|
@ -58,6 +58,7 @@ def build_for_dev_server(host, port, minify, disable_host_check):
|
||||||
if disable_host_check:
|
if disable_host_check:
|
||||||
webpack_args.append('--disable-host-check')
|
webpack_args.append('--disable-host-check')
|
||||||
|
|
||||||
|
try:
|
||||||
webpack_process = subprocess.Popen(webpack_args)
|
webpack_process = subprocess.Popen(webpack_args)
|
||||||
|
|
||||||
class WebpackConfigFileChangeHandler(pyinotify.ProcessEvent):
|
class WebpackConfigFileChangeHandler(pyinotify.ProcessEvent):
|
||||||
|
@ -69,7 +70,6 @@ def build_for_dev_server(host, port, minify, disable_host_check):
|
||||||
webpack_process.wait()
|
webpack_process.wait()
|
||||||
webpack_process = subprocess.Popen(webpack_args)
|
webpack_process = subprocess.Popen(webpack_args)
|
||||||
|
|
||||||
try:
|
|
||||||
watch_manager = pyinotify.WatchManager()
|
watch_manager = pyinotify.WatchManager()
|
||||||
event_notifier = pyinotify.Notifier(watch_manager, WebpackConfigFileChangeHandler())
|
event_notifier = pyinotify.Notifier(watch_manager, WebpackConfigFileChangeHandler())
|
||||||
for file in ['webpack.config.ts', 'webpack-helpers.ts', 'webpack.assets.json']:
|
for file in ['webpack.config.ts', 'webpack-helpers.ts', 'webpack.assets.json']:
|
||||||
|
|
Loading…
Reference in New Issue