command_runner v1.2
Source Code in griptape/utils/command_runner.py
@define class CommandRunner: def run(self, command: str) -> BaseArtifact: process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = process.communicate() if len(stderr) == 0: return TextArtifact(stdout.strip().decode()) return ErrorArtifact(f"error: {stderr.strip()}")
run(command)
Source Code in griptape/utils/command_runner.py
def run(self, command: str) -> BaseArtifact: process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = process.communicate() if len(stderr) == 0: return TextArtifact(stdout.strip().decode()) return ErrorArtifact(f"error: {stderr.strip()}")
- On this page
- run(command)