Skip to content

Commit 2c5cea6

Browse files
committed
Validate file path for add_process
1 parent fcb479a commit 2c5cea6

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

simvue/run.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import json
1212
import logging
1313
import mimetypes
14-
import pathlib
1514
import multiprocessing.synchronize
1615
import threading
1716
import humanfriendly
@@ -610,8 +609,8 @@ def add_process(
610609
identifier: str,
611610
*cmd_args,
612611
executable: typing.Optional[str] = None,
613-
script: typing.Optional[typing.Union[str, pathlib.Path]] = None,
614-
input_file: typing.Optional[typing.Union[str, pathlib.Path]] = None,
612+
script: typing.Optional[pydantic.FilePath] = None,
613+
input_file: typing.Optional[pydantic.FilePath] = None,
615614
completion_callback: typing.Optional[
616615
typing.Callable[[int, str, str], None]
617616
] = None,
@@ -684,18 +683,6 @@ def callback_function(status_code: int, std_out: str, std_err: str) -> None:
684683
_cmd_list: typing.List[str] = []
685684
_pos_args = list(cmd_args)
686685

687-
if script:
688-
if isinstance(script, str):
689-
script = pathlib.Path(script)
690-
if not script.exists():
691-
self._error(f"Script '{script}' not found.")
692-
693-
if input_file:
694-
if isinstance(input_file, str):
695-
input_file = pathlib.Path(input_file)
696-
if not input_file.exists():
697-
self._error(f"Script '{input_file}' not found.")
698-
699686
# Assemble the command for saving to metadata as string
700687
if executable:
701688
_cmd_list += [executable]

0 commit comments

Comments
 (0)