diff options
| author | Giampaolo Rodola <g.rodola@gmail.com> | 2019-11-22 00:19:43 +0800 |
|---|---|---|
| committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-11-22 00:19:43 +0800 |
| commit | edb20f664f28653dcdd24f0bf0191984738dca6e (patch) | |
| tree | e9c8f563f58ee28070113b1097cb63f1fbe3a05e /psutil/tests/test_linux.py | |
| parent | d739cbb1a5b207212d467b219dfc25b017911530 (diff) | |
| download | psutil-edb20f664f28653dcdd24f0bf0191984738dca6e.tar.gz | |
linux, cmdline(), fix for #1179, comment 552984549: sometimes string ends with null byte but args are separated by spaces
Diffstat (limited to 'psutil/tests/test_linux.py')
| -rwxr-xr-x | psutil/tests/test_linux.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py index 09fed4e4..ccde735d 100755 --- a/psutil/tests/test_linux.py +++ b/psutil/tests/test_linux.py @@ -1837,6 +1837,14 @@ class TestProcess(unittest.TestCase): self.assertEqual(p.cmdline(), ['foo', 'bar', '']) assert m.called + def test_cmdline_mixed_separators(self): + p = psutil.Process() + fake_file = io.StringIO(u('foo\x20bar\x00')) + with mock.patch('psutil._common.open', + return_value=fake_file, create=True) as m: + self.assertEqual(p.cmdline(), ['foo', 'bar']) + assert m.called + def test_readlink_path_deleted_mocked(self): with mock.patch('psutil._pslinux.os.readlink', return_value='/home/foo (deleted)'): |
