chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
from e2b.exceptions import SandboxException
|
||||
|
||||
Stdout = str
|
||||
"""
|
||||
Command stdout output.
|
||||
"""
|
||||
Stderr = str
|
||||
"""
|
||||
Command stderr output.
|
||||
"""
|
||||
PtyOutput = bytes
|
||||
"""
|
||||
Pty output.
|
||||
"""
|
||||
|
||||
|
||||
@dataclass
|
||||
class PtySize:
|
||||
"""
|
||||
Pseudo-terminal size.
|
||||
"""
|
||||
|
||||
rows: int
|
||||
"""
|
||||
Number of rows.
|
||||
"""
|
||||
cols: int
|
||||
"""
|
||||
Number of columns.
|
||||
"""
|
||||
|
||||
|
||||
@dataclass
|
||||
class CommandResult:
|
||||
"""
|
||||
Command execution result.
|
||||
"""
|
||||
|
||||
stderr: str
|
||||
"""
|
||||
Command stderr output.
|
||||
"""
|
||||
stdout: str
|
||||
"""
|
||||
Command stdout output.
|
||||
"""
|
||||
exit_code: int
|
||||
"""
|
||||
Command exit code.
|
||||
|
||||
`0` if the command finished successfully.
|
||||
"""
|
||||
error: Optional[str]
|
||||
"""
|
||||
Error message from command execution if it failed.
|
||||
"""
|
||||
|
||||
|
||||
@dataclass
|
||||
class CommandExitException(SandboxException, CommandResult):
|
||||
"""
|
||||
Exception raised when a command exits with a non-zero exit code.
|
||||
"""
|
||||
|
||||
def __str__(self):
|
||||
return f"Command exited with code {self.exit_code} and error:\n{self.stderr}"
|
||||
@@ -0,0 +1,39 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class ProcessInfo:
|
||||
"""
|
||||
Information about a command, PTY session or start command running in the sandbox as process.
|
||||
"""
|
||||
|
||||
pid: int
|
||||
"""
|
||||
Process ID.
|
||||
"""
|
||||
|
||||
tag: Optional[str]
|
||||
"""
|
||||
Custom tag used for identifying special commands like start command in the custom template.
|
||||
"""
|
||||
|
||||
cmd: str
|
||||
"""
|
||||
Command that was executed.
|
||||
"""
|
||||
|
||||
args: List[str]
|
||||
"""
|
||||
Command arguments.
|
||||
"""
|
||||
|
||||
envs: Dict[str, str]
|
||||
"""
|
||||
Environment variables used for the command.
|
||||
"""
|
||||
|
||||
cwd: Optional[str]
|
||||
"""
|
||||
Executed command working directory.
|
||||
"""
|
||||
Reference in New Issue
Block a user