Does anyone know a portable way for Python to determine a system's maximum command line length? The program I'm working on builds a command and feeds it to subprocess. For systems with smaller command line length maximums, it is possible that the command will be too long. If I can detect that, the command can be broken up to avoid exceeding the maximum length, but I've not found a (portable) way to determine the maximum.
Now why couldn't I find that? Thanks! Alas, it doesn't work on my Windows system, but that may be okay. However, I expect I'll need to make it work on a Mac, even though I don't have access to one. Do you know if sysconf is available on OS X?
PTBNL
2009-09-30 21:11:37
Should work fine on OS X.
Alex Martelli
2009-09-30 22:00:54
The docs state this is for Unix only (both Mac and Unix for <= Python2.5). Also the dictionary lookup is not required, `os.sysconf('SC_ARG_MAX')` also works.
mhawke
2009-10-01 04:26:36