ITP WiP
This commit is contained in:
@@ -19,6 +19,7 @@ class BackgroundEntry(Entry):
|
||||
def __init__(
|
||||
self,
|
||||
id: str,
|
||||
work_dir: str,
|
||||
script: str,
|
||||
):
|
||||
"""
|
||||
@@ -26,9 +27,11 @@ class BackgroundEntry(Entry):
|
||||
|
||||
Args:
|
||||
id: Unique identifier for this entry
|
||||
work_dir: Working directory for the process
|
||||
script: The script/command to execute
|
||||
"""
|
||||
super().__init__(id)
|
||||
self.work_dir = work_dir
|
||||
self.script = script
|
||||
self._process: Optional[subprocess.Popen] = None
|
||||
self.stdout = ""
|
||||
@@ -81,6 +84,7 @@ class BackgroundEntry(Entry):
|
||||
if self._process is None and self.exit_code is None:
|
||||
self._process = subprocess.Popen(
|
||||
self.script,
|
||||
cwd=self.work_dir,
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
@@ -155,6 +159,7 @@ class BackgroundEntry(Entry):
|
||||
return {
|
||||
"type": "background",
|
||||
"id": self.id,
|
||||
"work_dir": str(self.work_dir),
|
||||
"script": self.script,
|
||||
"stdout": self.stdout,
|
||||
"stderr": self.stderr,
|
||||
|
||||
Reference in New Issue
Block a user