Commit 16d9b557 authored by Jérome Perrin's avatar Jérome Perrin

software/theia: generate a shell compatible with tasks

When running tasks, shell is invoked like:

   $THEIA_SHELL -c "command with arguments that\ can\ contain\ spaces"
parent a41f3e8c
Pipeline #10597 failed with stage
......@@ -15,7 +15,7 @@
[instance]
filename = instance.cfg.in
md5sum = 0cd7d44974b568dbb7b880d6c103dfdf
md5sum = d8ad39bc93c492026a93c28b33a5dc3a
[yarn.lock]
filename = yarn.lock
......
......@@ -121,7 +121,7 @@ recipe = slapos.cookbook:userinfo
recipe = slapos.cookbook:wrapper
wrapper-path = $${directory:services}/$${:_buildout_section_name_}
command-line =
env LC_ALL=C.UTF-8 TMP=$${directory:tmp} THEIA_WEBVIEW_EXTERNAL_ENDPOINT='{{hostname}}' THEIA_SHELL=$${theia-shell:wrapper-path} ${theia-wrapper:rendered} --hostname=$${:hostname} --port=$${:port} $${directory:project}
env LC_ALL=C.UTF-8 TMP=$${directory:tmp} THEIA_WEBVIEW_EXTERNAL_ENDPOINT='{{hostname}}' THEIA_SHELL=$${theia-shell:rendered} ${theia-wrapper:rendered} --hostname=$${:hostname} --port=$${:port} $${directory:project}
ip = $${instance-parameter:ipv4-random}
hostname = $${:ip}
......@@ -132,12 +132,18 @@ hash-existing-files =
${theia-wrapper:rendered}
[theia-shell]
recipe = slapos.cookbook:wrapper
wrapper-path = $${directory:bin}/$${:_buildout_section_name_}
# reset GIT_EXEC_PATH to workaround https://github.com/eclipse-theia/theia/issues/7555
# activate slapos configuration
command-line =
${bash:location}/bin/bash -c ". $${slapos-standalone-activate:rendered} && exec env GIT_EXEC_PATH= ${bash:location}/bin/bash"
recipe = slapos.recipe.template:jinja2
rendered = $${directory:bin}/$${:_buildout_section_name_}
mode = 0700
template = inline:
#!${python:location}/bin/python
import sys
import os
args = sys.argv[1:]
# when running interactively, activate slapos configuration and reset GIT_EXEC_PATH to workaround https://github.com/eclipse-theia/theia/issues/7555
if not args: args = ["-c", ". $${slapos-standalone-activate:rendered} && exec env GIT_EXEC_PATH= ${bash:location}/bin/bash", ]
os.execv('${bash:location}/bin/bash', ['${bash:location}/bin/bash'] + args)
[slapos-standalone-activate]
recipe = slapos.recipe.template:jinja2
......
......@@ -29,6 +29,7 @@ from __future__ import unicode_literals
import os
import textwrap
import logging
import subprocess
import tempfile
import time
from six.moves.urllib.parse import urlparse, urljoin
......@@ -131,3 +132,13 @@ class TestTheia(SlapOSInstanceTestCase):
process.terminate()
process.wait()
def test_theia_shell_execute_tasks(self):
# shell needs to understand -c "comamnd" arguments for theia tasks feature
test_file = '{}/test file'.format(self.computer_partition_root_path)
subprocess.check_call([
'{}/bin/theia-shell'.format(self.computer_partition_root_path),
'-c',
'touch "{}"'.format(test_file)
])
self.assertTrue(os.path.exists(test_file))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment