From 3ef0fe19f874fff21fb0e04612bf358b1a151a9c Mon Sep 17 00:00:00 2001 From: Aldo Adirajasa Fathoni Date: Tue, 26 Sep 2023 13:21:02 +0700 Subject: [PATCH 1/3] Fix calling write() from int instead of os --- console/socketiod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/console/socketiod b/console/socketiod index a53a6f1..3c3c9b6 100755 --- a/console/socketiod +++ b/console/socketiod @@ -176,7 +176,7 @@ def connect(sid, environ): if child_pid: # already started child process, don't start another # write a new line so that when a client refresh the shell prompt is printed - fd.write("\n") + os.write(fd, str.encode("\n")) return # create child process attached to a pty we can read from and write to From 84e22e4a8cdec677f157d1142560b40b0af31990 Mon Sep 17 00:00:00 2001 From: Aldo Adirajasa Fathoni Date: Tue, 26 Sep 2023 13:23:20 +0700 Subject: [PATCH 2/3] Ignore if pty process has exited --- console/socketiod | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/console/socketiod b/console/socketiod index 3c3c9b6..55342d1 100755 --- a/console/socketiod +++ b/console/socketiod @@ -200,8 +200,13 @@ def disconnect(sid): global child_pid # kill pty process - os.kill(child_pid, signal.SIGKILL) - os.wait() + try: + os.kill(child_pid, signal.SIGKILL) + os.wait() + except ProcessLookupError: + pass + except ChildProcessError: + pass # reset the variables fd = None From 64fdb9315d8ffbc608fbbb8492d20418b6f42b7b Mon Sep 17 00:00:00 2001 From: Aldo Adirajasa Fathoni Date: Tue, 26 Sep 2023 21:56:27 +0700 Subject: [PATCH 3/3] Fix socketio default host The previous value caused webvirtcloud to try to connect to socketiod with 0.0.0.0. --- webvirtcloud/settings.py.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webvirtcloud/settings.py.template b/webvirtcloud/settings.py.template index fabe94c..88146c1 100644 --- a/webvirtcloud/settings.py.template +++ b/webvirtcloud/settings.py.template @@ -201,7 +201,7 @@ WS_PUBLIC_PATH = "/novncd/" WS_CERT = None SOCKETIO_PORT = 6081 -SOCKETIO_HOST = '0.0.0.0' +SOCKETIO_HOST = "0.0.0.0" # Socketio public host SOCKETIO_PUBLIC_HOST = None