forked from All-Hands-AI/OpenHands
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a CommandExecutor abstract class (All-Hands-AI#874)
* Create abstract CommandExecutor class * Use CommandExecutor for Sandbox
- Loading branch information
Showing
3 changed files
with
33 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from typing import Tuple | ||
from abc import ABC, abstractmethod | ||
|
||
|
||
class CommandExecutor(ABC): | ||
@abstractmethod | ||
def execute(self, cmd: str) -> Tuple[int, str]: | ||
pass | ||
|
||
@abstractmethod | ||
def execute_in_background(self, cmd: str): | ||
pass | ||
|
||
@abstractmethod | ||
def kill_background(self, id: int): | ||
pass | ||
|
||
@abstractmethod | ||
def read_logs(self, id: int) -> str: | ||
pass | ||
|
||
@abstractmethod | ||
def close(self): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters