added send command option in the window
This commit is contained in:
@@ -25,7 +25,7 @@ class BOSMiner(BaseMiner):
|
||||
# return created connection
|
||||
return conn
|
||||
|
||||
async def send_ssh_command(self, cmd: str) -> None:
|
||||
async def send_ssh_command(self, cmd: str):
|
||||
"""Sends SSH command to miner."""
|
||||
# creates result variable
|
||||
result = None
|
||||
@@ -42,17 +42,8 @@ class BOSMiner(BaseMiner):
|
||||
if i == 3:
|
||||
return
|
||||
continue
|
||||
return result
|
||||
|
||||
# let the user know the result of the command
|
||||
if result is not None:
|
||||
if result.stdout != "":
|
||||
print(result.stdout)
|
||||
if result.stderr != "":
|
||||
print("ERROR: " + result.stderr)
|
||||
elif result.stderr != "":
|
||||
print("ERROR: " + result.stderr)
|
||||
else:
|
||||
print(cmd)
|
||||
|
||||
async def fault_light_on(self) -> None:
|
||||
"""Sends command to turn on fault light on the miner."""
|
||||
|
||||
@@ -72,31 +72,7 @@ class CGMiner(BaseMiner):
|
||||
if i == 3:
|
||||
return
|
||||
continue
|
||||
# handle result
|
||||
self._result_handler(result)
|
||||
|
||||
@staticmethod
|
||||
def _result_handler(result: asyncssh.process.SSHCompletedProcess) -> None:
|
||||
if result is not None:
|
||||
# noinspection PyUnresolvedReferences
|
||||
if len(result.stdout) > 0:
|
||||
# noinspection PyUnresolvedReferences
|
||||
print("ssh stdout: \n" + result.stdout)
|
||||
# noinspection PyUnresolvedReferences
|
||||
if len(result.stderr) > 0:
|
||||
# noinspection PyUnresolvedReferences
|
||||
print("ssh stderr: \n" + result.stderrr)
|
||||
# noinspection PyUnresolvedReferences
|
||||
if len(result.stdout) <= 0 and len(result.stderr) <= 0:
|
||||
print("ssh stdout stderr empty")
|
||||
# if result.stdout != "":
|
||||
# print(result.stdout)
|
||||
# if result.stderr != "":
|
||||
# print("ERROR: " + result.stderr)
|
||||
# elif result.stderr != "":
|
||||
# print("ERROR: " + result.stderr)
|
||||
# else:
|
||||
# print(cmd)
|
||||
return result
|
||||
|
||||
async def restart_backend(self) -> None:
|
||||
await self.restart_cgminer()
|
||||
@@ -133,4 +109,3 @@ class CGMiner(BaseMiner):
|
||||
self._result_handler(result)
|
||||
self.config = result.stdout
|
||||
print(str(self.config))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user