diff --git a/software/theia/buildout.hash.cfg b/software/theia/buildout.hash.cfg index cd11b25e339af25ad4bf3626b3a30bb565a09483..318c78bbdea0fc9538ca2f3ef9deb8a35d5b93d7 100644 --- a/software/theia/buildout.hash.cfg +++ b/software/theia/buildout.hash.cfg @@ -15,7 +15,7 @@ [instance] filename = instance.cfg.in -md5sum = 0cd7d44974b568dbb7b880d6c103dfdf +md5sum = d8ad39bc93c492026a93c28b33a5dc3a [yarn.lock] filename = yarn.lock diff --git a/software/theia/instance.cfg.in b/software/theia/instance.cfg.in index 52eb62a44957fe1b2ab1953b555e14dff329fd1b..f747d0d425e33374ed12018e466b8bbddfd4efe9 100644 --- a/software/theia/instance.cfg.in +++ b/software/theia/instance.cfg.in @@ -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 diff --git a/software/theia/test/test.py b/software/theia/test/test.py index 43cd3f10435fe63a53c9856f9db12f19e19db064..23a97dacb746bc95f654d29f08776c374abaf6b8 100644 --- a/software/theia/test/test.py +++ b/software/theia/test/test.py @@ -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))