-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1565 from KBVE/beta
Preparing Release Branch
- Loading branch information
Showing
13 changed files
with
3,462 additions
and
6 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
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
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,29 @@ | ||
import subprocess | ||
import os | ||
import asyncio | ||
import logging | ||
|
||
logger = logging.getLogger("uvicorn") | ||
|
||
class RuneLiteClient: | ||
def __init__(self, display=":20", jar_path="/usr/local/bin/runelite.jar"): | ||
self.display = display | ||
self.jar_path = jar_path | ||
|
||
async def start_runelite_async(self): | ||
env = os.environ.copy() | ||
env["DISPLAY"] = self.display | ||
try: | ||
# Since subprocess.run is not async, use asyncio to run it in a thread pool | ||
await asyncio.to_thread( | ||
subprocess.run, ["java", "-jar", self.jar_path], env=env | ||
) | ||
logger.info("RuneLite started successfully.") | ||
return "RuneLite started successfully." | ||
except Exception as e: | ||
logger.error(f"Failed to start RuneLite: {e}") | ||
return f"Failed to start RuneLite: {e}" | ||
|
||
async def close(self): | ||
# This method is required by the KRDecorator's pattern, even if it does nothing | ||
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
Oops, something went wrong.