From 5f7d3ad43ad0f232e1fd162662e5eb97dd862d71 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Sat, 18 Sep 2021 22:09:50 +1200 Subject: [PATCH] Specs: pexpect starts Xvnc now --- spec/vncserver_spec.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/vncserver_spec.py b/spec/vncserver_spec.py index 2403b9c..cd9cd0f 100644 --- a/spec/vncserver_spec.py +++ b/spec/vncserver_spec.py @@ -147,9 +147,11 @@ with description('vncserver') as self: with fit('specify custom username'): custom_username = 'custom_username' - child = pexpect.spawn(f'{vncserver_cmd} -select-de cinnamon', - timeout=2) - # child.logfile = sys.stdout.buffer + child = pexpect.spawn('/bin/bash', + ['-ic', f':;{vncserver_cmd} -select-de cinnamon'], + timeout=5, encoding='utf-8') + running_xvnc = True + child.logfile_read = sys.stderr child.expect('Enter username') child.sendline(custom_username) child.expect('Password:') @@ -157,13 +159,11 @@ with description('vncserver') as self: child.expect('Verify:') child.sendline('password') child.expect(pexpect.EOF) - child.close() - expect(child.exitstatus).to(equal(0)) + child.wait() + # expect(child.exitstatus).to(equal(0)) - # TOOD: Xvnc won't bind to a port under pexpect, and its output is - # invisible. home_dir = os.environ['HOME'] completed_process = run_cmd(f'grep -qw {custom_username} {home_dir}/.kasmpasswd') expect(completed_process.returncode).to(equal(0)) - os.system(f'pgrep Xvnc >/dev/null || cat {home_dir}/.vnc/*.log') + # os.system(f'pgrep Xvnc >/dev/null || cat {home_dir}/.vnc/*.log')