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

Commit6005728

Browse files
PsUtilProcessProxy is updated (refactoring) (#212)
1 parent44f280b commit6005728

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

‎testgres/operations/remote_ops.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,25 @@
2626

2727
classPsUtilProcessProxy:
2828
def__init__(self,ssh,pid):
29+
assertisinstance(ssh,RemoteOperations)
30+
asserttype(pid)==int# noqa: E721
2931
self.ssh=ssh
3032
self.pid=pid
3133

3234
defkill(self):
33-
command="kill {}".format(self.pid)
34-
self.ssh.exec_command(command)
35+
assertisinstance(self.ssh,RemoteOperations)
36+
asserttype(self.pid)==int# noqa: E721
37+
command= ["kill",str(self.pid)]
38+
self.ssh.exec_command(command,encoding=get_default_encoding())
3539

3640
defcmdline(self):
37-
command="ps -p {} -o cmd --no-headers".format(self.pid)
38-
stdin,stdout,stderr=self.ssh.exec_command(command,verbose=True,encoding=get_default_encoding())
39-
cmdline=stdout.strip()
41+
assertisinstance(self.ssh,RemoteOperations)
42+
asserttype(self.pid)==int# noqa: E721
43+
command= ["ps","-p",str(self.pid),"-o","cmd","--no-headers"]
44+
output=self.ssh.exec_command(command,encoding=get_default_encoding())
45+
asserttype(output)==str# noqa: E721
46+
cmdline=output.strip()
47+
# TODO: This code work wrong if command line contains quoted values. Yes?
4048
returncmdline.split()
4149

4250

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp