[REF] script: use Execute helper in git daemon
Replace raw subprocess.Popen and manual signal handling with Execute.exec_command_live for consistency with other refactored scripts. Generated by Claude Code 2.1.72 model claude-sonnet-4-6 Co-Authored-By: Mathieu Benoit <mathben@technolibre.ca>
This commit is contained in:
parent
8083c8010e
commit
43fd5a17ae
1 changed files with 17 additions and 18 deletions
|
|
@ -5,11 +5,17 @@
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import signal
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
|
new_path = os.path.normpath(
|
||||||
|
os.path.join(os.path.dirname(__file__), "..", "..")
|
||||||
|
)
|
||||||
|
sys.path.append(new_path)
|
||||||
|
|
||||||
|
from script.execute.execute import Execute
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
DEFAULT_ERPLIBRE_PATH = os.path.normpath(
|
DEFAULT_ERPLIBRE_PATH = os.path.normpath(
|
||||||
|
|
@ -529,28 +535,21 @@ def serve_git_daemon(git_path, projects, port):
|
||||||
"""Start git daemon to serve repos."""
|
"""Start git daemon to serve repos."""
|
||||||
print_clone_commands(git_path, projects, port)
|
print_clone_commands(git_path, projects, port)
|
||||||
|
|
||||||
cmd = [
|
cmd = (
|
||||||
"git",
|
f"git daemon --reuseaddr"
|
||||||
"daemon",
|
f" --base-path={git_path}"
|
||||||
"--reuseaddr",
|
f" --port={port}"
|
||||||
f"--base-path={git_path}",
|
f" --export-all"
|
||||||
f"--port={port}",
|
f" --enable=receive-pack"
|
||||||
"--export-all",
|
f" {git_path}"
|
||||||
"--enable=receive-pack",
|
)
|
||||||
git_path,
|
|
||||||
]
|
|
||||||
print(f"Starting git daemon on port {port}...")
|
print(f"Starting git daemon on port {port}...")
|
||||||
print(f" Base path: {git_path}")
|
print(f" Base path: {git_path}")
|
||||||
print(f" URL: git://localhost:{port}/")
|
print(f" URL: git://localhost:{port}/")
|
||||||
print(" Press Ctrl+C to stop")
|
print(" Press Ctrl+C to stop")
|
||||||
|
|
||||||
try:
|
execute = Execute()
|
||||||
process = subprocess.Popen(cmd)
|
execute.exec_command_live(cmd, source_erplibre=False)
|
||||||
process.wait()
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
print("\nStopping git daemon...")
|
|
||||||
process.send_signal(signal.SIGTERM)
|
|
||||||
process.wait()
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue