Skip to content
This repository has been archived by the owner on Apr 24, 2018. It is now read-only.

Checks platform.system to determine POSIX mode #25

Closed
wants to merge 6 commits into from

Conversation

srathbun
Copy link

@srathbun srathbun commented Mar 5, 2012

This fixes a quoting issue with the shlex module in expand_args on windows. Under posix mode, words in " are expanded. So, 'cat "c:/program files/test.txt"' gets passed in as ['cat', 'c:/program files/test.txt']. With the double quotes removed, the underlying windows os sees two arguments, and fails to find either.

I've added a variable POSIX to hold True or False based upon the results from platform.system(). Anything that needs to check posix mode should use this value.

… better than before, but it still fails some cases.
…gns, pipes, and quotes. The quotes need more testing of edge cases.
…te surrounding it, gs does not strip it out. Since " is invalid for filenames on windows, this does not work.

I've configured it to only parse once over the input string, thus avoiding the original reason for switching to Non posix mode.

Also, it is set up to allow setting of posix mode manually if the user needs to.

Non posix mode still handles quotes slightly oddly, in that if a command such as -I"c:/program files/gs/gs9.05/fonts" is input, two tokens are returned.

This can be fixed, if necessary, in Non posix mode since tokens are examined individually, instead of just using shlex.split() and getting a list.
@srathbun srathbun closed this May 2, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant