aboutsummaryrefslogtreecommitdiffstats
path: root/packaging/win/node-entry.py
diff options
context:
space:
mode:
Diffstat (limited to 'packaging/win/node-entry.py')
-rw-r--r--packaging/win/node-entry.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/packaging/win/node-entry.py b/packaging/win/node-entry.py
index 6fadad7..a502a37 100644
--- a/packaging/win/node-entry.py
+++ b/packaging/win/node-entry.py
@@ -1,12 +1,23 @@
"""PyInstaller entry point for the bundled Windows node daemon.
`meshbay_node.daemon:main` is a module function; PyInstaller freezes a script.
-This is that script — nothing more. The frozen binary is `meshbay-node.exe`,
+This is that script. The frozen binary is `meshbay-node.exe`,
relocatable, and is what the desktop client spawns and what the W3 autostart
-launcher points at (`meshbay_node.platform._node_exe`).
+launcher points at (`meshbay_node.platform._node_exe`). `meshbay-nodew.exe` is
+the same script built without a console (meshbay-node.spec).
"""
-from meshbay_node.daemon import main
+import os
+import sys
+
+# meshbay-nodew.exe, the build without a console, starts with no stdio at all
+# (sys.stdout and sys.stderr are None), and a library that writes to either or
+# asks whether it is a terminal would raise. The daemon logs to node.log.
+for _name in ("stdout", "stderr"):
+ if getattr(sys, _name) is None:
+ setattr(sys, _name, open(os.devnull, "w", encoding="utf-8"))
+
+from meshbay_node.daemon import main # noqa: E402
if __name__ == "__main__":
main()