File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/win_runas.cpython-310.pyc
Back
o ;j�R � @ s� d Z ddlZddlZddlZddlZddlZddlZddlmZ z,ddl Z ddl Z ddlZddlZddl Z ddlZddlZddlZddlZddlZdZW n eyW dZY nw e�e�Zddd�Zd d � Zdd� Zddd�Zddd�Zddd�ZdS )aV Run child processes as another Windows user. The main entry points are :func:`runas` (starts the child with ``CreateProcessWithTokenW`` when the minion can obtain a privileged context) and :func:`runas_unpriv` (uses ``CreateProcessWithLogonW`` as a fallback). Both are used from :mod:`salt.modules.cmdmod` when ``runas`` is set on Windows. � N)�CommandExecutionErrorTF�� c C s6 t | t�r| nt| �}t|�|kr|d|� d S |S )aI Shorten a command line for safe logging (full line is never executed from this helper). Args: cmd: Command string; non-strings are formatted with ``repr()``. max_len: Maximum length before truncation; an ellipsis is appended. Returns: Truncated string suitable for debug log lines. Nu …)� isinstance�str�repr�len)�cmdZmax_len�s� r �H/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/win_runas.py�_preview_cmd* s r c C s t sdS dS )z� Load this module only when PyWin32 (and related imports) succeeded. Returns: The string ``win_runas`` on success, or ``(False, reason)`` when required imports failed so the loader should skip the module. )FzThis utility requires pywin32Z win_runas)� HAS_WIN32r r r r �__virtual__>