Argument list too long 错误排查说明


核心原因:
All shell have / has a limit for the command line length. UNIX / Linux / BSD system has a limit on how many bytes can be used for the command line argument and environment variables.

查看方法:
getconf ARG_MAX

复现代码:
#!/usr/bin/python

import json
import subprocess


ENV_D = {}
with open('./13e3eaff3b4f.json') as f :

    metedata = json.load(f)
    ENV = metedata[0]['Config']['Env']

for item in ENV:
    key = item.split('=')[0]
    value = item.split('=')[1]
    ENV_D[key] = value
    ENV_D[key+'1'] = value
p = subprocess.Popen(['env |wc -c'],shell=True,env=ENV_D,stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
p.wait()
print p.stdout.read()

Pingbacks已打开。

Trackbacks

引用地址

评论
发表评论