Skip to content

Commit 1202cc0

Browse files
Use shlex.split
1 parent ac71a3d commit 1202cc0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tin/apps/assignments/models.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import datetime
44
import logging
55
import os
6+
import shlex
67
import subprocess
78
from typing import Literal
89

@@ -620,7 +621,9 @@ def __repr__(self):
620621

621622
def run(self, assignment: Assignment):
622623
"""Runs the command on the input assignment"""
623-
command = self.command.split(" ")
624+
# shlex.split splits it with POSIX-style shell syntax
625+
# This handles e.g. echo "Hello World" correctly
626+
command = shlex.split(self.command)
624627

625628
if (
626629
("$FILE" in self.command or "$FILES" in self.command)

0 commit comments

Comments
 (0)