clan-cli: improve debug logging
This commit is contained in:
parent
8856758dbc
commit
f885c877bc
@ -4,7 +4,6 @@ from types import ModuleType
|
|||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from . import config, create, join, machines, secrets, vms, webui
|
from . import config, create, join, machines, secrets, vms, webui
|
||||||
from .errors import ClanError
|
|
||||||
from .ssh import cli as ssh_cli
|
from .ssh import cli as ssh_cli
|
||||||
|
|
||||||
argcomplete: Optional[ModuleType] = None
|
argcomplete: Optional[ModuleType] = None
|
||||||
@ -68,11 +67,8 @@ def main() -> None:
|
|||||||
|
|
||||||
if not hasattr(args, "func"):
|
if not hasattr(args, "func"):
|
||||||
return
|
return
|
||||||
try:
|
|
||||||
args.func(args)
|
args.func(args)
|
||||||
except ClanError as e:
|
|
||||||
print(e, file=sys.stderr)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -9,7 +9,7 @@ def join(args: argparse.Namespace) -> None:
|
|||||||
# start webui in background
|
# start webui in background
|
||||||
uri = args.flake_uri.removeprefix("clan://")
|
uri = args.flake_uri.removeprefix("clan://")
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["clan", "webui", f"/join?flake={urllib.parse.quote_plus(uri)}"],
|
["clan", "--debug", "webui", f"/join?flake={urllib.parse.quote_plus(uri)}"],
|
||||||
# stdout=sys.stdout,
|
# stdout=sys.stdout,
|
||||||
# stderr=sys.stderr,
|
# stderr=sys.stderr,
|
||||||
)
|
)
|
||||||
|
@ -51,10 +51,10 @@ class Command:
|
|||||||
try:
|
try:
|
||||||
for line in fd:
|
for line in fd:
|
||||||
if fd == self.p.stderr:
|
if fd == self.p.stderr:
|
||||||
self.log.debug(f"[{cmd[0]}] stderr: {line}")
|
print(f"[{cmd[0]}] stderr: {line}")
|
||||||
self.stderr.append(line)
|
self.stderr.append(line)
|
||||||
else:
|
else:
|
||||||
self.log.debug(f"[{cmd[0]}] stdout: {line}")
|
print(f"[{cmd[0]}] stdout: {line}")
|
||||||
self.stdout.append(line)
|
self.stdout.append(line)
|
||||||
self._output.put(line)
|
self._output.put(line)
|
||||||
except BlockingIOError:
|
except BlockingIOError:
|
||||||
|
@ -177,7 +177,7 @@ python3.pkgs.buildPythonApplication {
|
|||||||
desktopItems = [
|
desktopItems = [
|
||||||
(makeDesktopItem {
|
(makeDesktopItem {
|
||||||
name = "clan";
|
name = "clan";
|
||||||
exec = "clan join %u";
|
exec = "clan --debug join %u";
|
||||||
desktopName = "CLan Manager";
|
desktopName = "CLan Manager";
|
||||||
startupWMClass = "clan";
|
startupWMClass = "clan";
|
||||||
mimeTypes = [ "x-scheme-handler/clan" ];
|
mimeTypes = [ "x-scheme-handler/clan" ];
|
||||||
|
Loading…
Reference in New Issue
Block a user