Source code for fortrace.utility.applications.console.powershell

#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <https://www.gnu.org/licenses/>.
from typing import Optional

from fortrace.core.qemu_monitor import QEMUMonitorSession
from fortrace.utility.applications.application import ParentNotifier
from fortrace.utility.applications.console.terminal import GenericTerminal
from fortrace.utility.distribution_constants import ShellType


[docs] class PowerShell(GenericTerminal): def __init__( self, qs: QEMUMonitorSession, parent_notifier: ParentNotifier, run_as_administrator: bool = False, ): super().__init__("PowerShell", qs, parent_notifier, ShellType.POWERSHELL) self._administrative_privileges = run_as_administrator
[docs] def send_command( self, command: str, get_output: bool = False, **kwargs ) -> Optional[str]: self._qs.send_text(command, True)
[docs] def close(self): self.send_command("exit")