@@ -54,6 +54,12 @@ def add_arguments(self, parser):
5454 "Vagrant and Docker for Mac)"
5555 ),
5656 )
57+ _unix_default = "fork" if sys .version_info < (3 , 14 ) else "forkserver"
58+ parser .add_argument (
59+ "--use-spawn" ,
60+ action = "store_true" ,
61+ help = f"start processes by spawning (default: { _unix_default } on unix, spawn on Windows and macOS)" ,
62+ )
5763 parser .add_argument (
5864 "--use-gevent" ,
5965 action = "store_true" ,
@@ -105,7 +111,7 @@ def add_arguments(self, parser):
105111 )
106112
107113 def handle (self , watch_dir , skip_logging , use_polling_watcher , use_gevent , path , processes , threads , verbosity ,
108- queues , pid_file , log_file , forks , worker_shutdown_timeout , ** options ):
114+ queues , pid_file , log_file , forks , worker_shutdown_timeout , use_spawn , ** options ):
109115 executable_name = "dramatiq-gevent" if use_gevent else "dramatiq"
110116 executable_path = self ._resolve_executable (executable_name )
111117 watch_args = ["--watch" , watch_dir ] if watch_dir else []
@@ -151,6 +157,9 @@ def handle(self, watch_dir, skip_logging, use_polling_watcher, use_gevent, path,
151157 if skip_logging :
152158 process_args .append ("--skip-logging" )
153159
160+ if use_spawn :
161+ process_args .append ("--use-spawn" )
162+
154163 self .stdout .write (' * Running dramatiq: "%s"\n \n ' % " " .join (process_args ))
155164
156165 if sys .platform == "win32" :
0 commit comments