Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit c3863ad

Browse files
authored
Merge pull request #5587 from matrix-org/erikj/fix_synctl
Fix --no-daemonize flag for synctl
2 parents de8077a + 8134c49 commit c3863ad

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

changelog.d/5587.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add --no-daemonize option to run synapse in the foreground, per issue #4130. Contributed by Soham Gumaste.

synctl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,17 @@ def main():
150150
parser.add_argument(
151151
"--no-daemonize",
152152
action="store_false",
153+
dest="daemonize",
153154
help="Run synapse in the foreground for debugging. "
154-
"Will work only if the daemonize option is not set in the config."
155+
"Will work only if the daemonize option is not set in the config.",
155156
)
156157

157158
options = parser.parse_args()
158159

159160
if options.worker and options.all_processes:
160161
write('Cannot use "--worker" with "--all-processes"', stream=sys.stderr)
161162
sys.exit(1)
162-
if options.no_daemonize and options.all_processes:
163+
if not options.daemonize and options.all_processes:
163164
write('Cannot use "--no-daemonize" with "--all-processes"', stream=sys.stderr)
164165
sys.exit(1)
165166

@@ -169,9 +170,8 @@ def main():
169170
write(
170171
"No config file found\n"
171172
"To generate a config file, run '%s -c %s --generate-config"
172-
" --server-name=<server name> --report-stats=<yes/no>'\n" % (
173-
" ".join(SYNAPSE), options.configfile,
174-
),
173+
" --server-name=<server name> --report-stats=<yes/no>'\n"
174+
% (" ".join(SYNAPSE), options.configfile),
175175
stream=sys.stderr,
176176
)
177177
sys.exit(1)
@@ -289,7 +289,7 @@ def main():
289289
# Check if synapse is already running
290290
if os.path.exists(pidfile) and pid_running(int(open(pidfile).read())):
291291
abort("synapse.app.homeserver already running")
292-
start(configfile, bool(options.no_daemonize))
292+
start(configfile, bool(options.daemonize))
293293

294294
for worker in workers:
295295
env = os.environ.copy()

0 commit comments

Comments
 (0)