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

Fix --no-daemonize flag for synctl #5587

Merged
merged 2 commits into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/5587.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add --no-daemonize option to run synapse in the foreground, per issue #4130. Contributed by Soham Gumaste.
12 changes: 6 additions & 6 deletions synctl
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,17 @@ def main():
parser.add_argument(
"--no-daemonize",
action="store_false",
dest="daemonize",
help="Run synapse in the foreground for debugging. "
"Will work only if the daemonize option is not set in the config."
"Will work only if the daemonize option is not set in the config.",
)

options = parser.parse_args()

if options.worker and options.all_processes:
write('Cannot use "--worker" with "--all-processes"', stream=sys.stderr)
sys.exit(1)
if options.no_daemonize and options.all_processes:
if not options.daemonize and options.all_processes:
write('Cannot use "--no-daemonize" with "--all-processes"', stream=sys.stderr)
sys.exit(1)

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

for worker in workers:
env = os.environ.copy()
Expand Down