27 lines
660 B
Python
27 lines
660 B
Python
|
#. -*- coding: utf-8
|
||
|
#
|
||
|
# novnc daemon spawner
|
||
|
|
||
|
#import site packages
|
||
|
import shlex, subprocess
|
||
|
|
||
|
|
||
|
def spawn(target, options):
|
||
|
""" spawn """
|
||
|
vnctarget = '{}:{} {}:{} '.format(target['listen_host'], target['listen_port'], target['target_host'], target['target_port'])
|
||
|
|
||
|
a_options = ''
|
||
|
for key, value in options.items():
|
||
|
if value == True:
|
||
|
c_option = '--{} '.format(key)
|
||
|
else:
|
||
|
c_option = '--{} {} '.format(key, value)
|
||
|
a_options += c_option
|
||
|
|
||
|
command_line = 'python3 runwebsockify.py ' + a_options + vnctarget
|
||
|
args = shlex.split(command_line)
|
||
|
p = subprocess.Popen(args)
|
||
|
print('spawn!')
|
||
|
|
||
|
|