Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process cmdline on Windows does not show quotation marks #118

Closed
giampaolo opened this issue May 23, 2014 · 4 comments
Closed

Process cmdline on Windows does not show quotation marks #118

giampaolo opened this issue May 23, 2014 · 4 comments

Comments

@giampaolo
Copy link
Owner

From g.rodola on October 17, 2010 22:17:27

======================================================================
FAIL: test_process_cmdline (_windows.WindowsSpecificTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\user\Desktop\svn\psutil\test\_windows.py", line 96, 
in test_process_cmdline
    self.assertEqual(' '.join(p.cmdline), w.CommandLine)
AssertionError: 'C:\\Python27\\python.exe -c import time; 
time.sleep(3600);' != u'C:\\Python27\\python.exe -c "import time; time.sleep(3600);"'

----------------------------------------------------------------------

Verified that both procexp and process hacker tools do not have this issue.
I took a look at process_info.c and didn't notice anything weird so I 
have no clue on where I might look.

Original issue: http://code.google.com/p/psutil/issues/detail?id=118

@giampaolo giampaolo self-assigned this May 23, 2014
@giampaolo
Copy link
Owner Author

From wj32...@gmail.com on October 17, 2010 22:17:01

It's because you call CommandLineToArgvW, and its purpose is to parse 
the command line string to remove quotes and backslashes...

@giampaolo
Copy link
Owner Author

From g.rodola on October 18, 2010 10:20:13

Hints on what to use as replacement?

@giampaolo
Copy link
Owner Author

From jlo...@gmail.com on October 18, 2010 11:44:27

We're returning an array of process arguments, not a string...  I 
would think this is expected behavior. This is similar to what you 
get from sys.argv where the arguments are already parsed, which is 
what CommandLineToArgvW is supposed to do, and we return the 
corresponding array of strings as a Python list.

@giampaolo
Copy link
Owner Author

From g.rodola on October 19, 2010 08:25:05

Verified that the same thing happens on Linux and BSD/OSX.
Thinking back I guess it's ok to return strings without quotation 
marks as well, also because that's what you would pass to 
subprocess.Popen in case you want to attempt to restart the process, for example.
I'm going to close this out and modify the test case.

Status: WontFix
Labels: -Type-Enhancement Type-Defect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant