Spaces:
Running
Running
Update tests.py
Browse files
tests.py
CHANGED
@@ -195,7 +195,7 @@ def create_code_files(filename: str, code) -> dict:
|
|
195 |
transfer_files2()
|
196 |
if isinstance(code, dict):
|
197 |
with open(os.path.join(destination_dir, filename), 'w', encoding='utf-8') as f:
|
198 |
-
json.dump(
|
199 |
else:
|
200 |
f = open(os.path.join(destination_dir, filename), "w")
|
201 |
f.write(str(code))
|
@@ -265,7 +265,6 @@ def run_code_files(start_cmd:str,forever_cmd:str) -> dict:
|
|
265 |
- After execution, embed a download link (or display images/gifs/videos directly in markdown format) in your response.
|
266 |
- When editing and subsequently re-executing the server with the forever_cmd='true' setting, the previous server instance will be automatically terminated, and the updated server will commence operation. This functionality negates the requirement for manual process termination commands such as pkill node.
|
267 |
- The opened ports can be externally accessed at https://suitable-liked-ibex.ngrok-free.app/ (ONLY if the website is running successfully)
|
268 |
-
|
269 |
"""
|
270 |
global files_list
|
271 |
|
@@ -293,11 +292,10 @@ def run_shell_command(cmd:str,forever_cmd:str) -> dict:
|
|
293 |
Important Environment Notes:
|
294 |
- The execution environment is **Alpine Linux**. Commands should be
|
295 |
compatible (e.g., `sudo apk add` instead of `sudo apt-get install`).
|
296 |
-
- `sudo` should
|
297 |
- Standard bash features like `&&`, `||`, pipes (`|`), etc., are supported.
|
298 |
- When installing python packages , add an argument --break-system-packages to the pip install command.
|
299 |
- The following npm packages are preinstalled: express ejs chart.js .Any additional packages can be installed with npm install command.
|
300 |
-
|
301 |
Args:
|
302 |
cmd (str): The shell command to execute.
|
303 |
Example: ``mkdir test_dir && ls -l``
|
|
|
195 |
transfer_files2()
|
196 |
if isinstance(code, dict):
|
197 |
with open(os.path.join(destination_dir, filename), 'w', encoding='utf-8') as f:
|
198 |
+
json.dump(code, f, ensure_ascii=False, indent=4)
|
199 |
else:
|
200 |
f = open(os.path.join(destination_dir, filename), "w")
|
201 |
f.write(str(code))
|
|
|
265 |
- After execution, embed a download link (or display images/gifs/videos directly in markdown format) in your response.
|
266 |
- When editing and subsequently re-executing the server with the forever_cmd='true' setting, the previous server instance will be automatically terminated, and the updated server will commence operation. This functionality negates the requirement for manual process termination commands such as pkill node.
|
267 |
- The opened ports can be externally accessed at https://suitable-liked-ibex.ngrok-free.app/ (ONLY if the website is running successfully)
|
|
|
268 |
"""
|
269 |
global files_list
|
270 |
|
|
|
292 |
Important Environment Notes:
|
293 |
- The execution environment is **Alpine Linux**. Commands should be
|
294 |
compatible (e.g., `sudo apk add` instead of `sudo apt-get install`).
|
295 |
+
- `sudo` should be used when root privelages are required. Eg- `sudo apk add <package>`
|
296 |
- Standard bash features like `&&`, `||`, pipes (`|`), etc., are supported.
|
297 |
- When installing python packages , add an argument --break-system-packages to the pip install command.
|
298 |
- The following npm packages are preinstalled: express ejs chart.js .Any additional packages can be installed with npm install command.
|
|
|
299 |
Args:
|
300 |
cmd (str): The shell command to execute.
|
301 |
Example: ``mkdir test_dir && ls -l``
|