Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

PsUtilProcessProxy is updated (refactoring)#212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PsUtilProcessProxy is updated (refactoring)
  • Loading branch information
@dmitry-lipetsk
dmitry-lipetsk committedMar 11, 2025
commit1c5d51a62345a16101d66e4ba66a88f8b92d3f53
18 changes: 13 additions & 5 deletionstestgres/operations/remote_ops.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,17 +26,25 @@

class PsUtilProcessProxy:
def __init__(self, ssh, pid):
assert isinstance(ssh, RemoteOperations)
assert type(pid) == int # noqa: E721
self.ssh = ssh
self.pid = pid

def kill(self):
command = "kill {}".format(self.pid)
self.ssh.exec_command(command)
assert isinstance(self.ssh, RemoteOperations)
assert type(self.pid) == int # noqa: E721
command = ["kill", str(self.pid)]
self.ssh.exec_command(command, encoding=get_default_encoding())

def cmdline(self):
command = "ps -p {} -o cmd --no-headers".format(self.pid)
stdin, stdout, stderr = self.ssh.exec_command(command, verbose=True, encoding=get_default_encoding())
cmdline = stdout.strip()
assert isinstance(self.ssh, RemoteOperations)
assert type(self.pid) == int # noqa: E721
command = ["ps", "-p", str(self.pid), "-o", "cmd", "--no-headers"]
output = self.ssh.exec_command(command, encoding=get_default_encoding())
assert type(output) == str # noqa: E721
cmdline = output.strip()
# TODO: This code work wrong if command line contains quoted values. Yes?
return cmdline.split()


Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp