def spawn(cmd, parse_json):
<EOL>with lock:<EOL><INDENT>p = Popen(["<STR_LIT>", "<STR_LIT>", "<STR_LIT>" + cmd],<EOL>stdout=PIPE, stderr=PIPE)<EOL>(stdout, stderr) = p.communicate()<EOL><DEDENT>stdout = stdout.decode('<STR_LIT:utf-8>')<EOL>stderr = stderr.decode('<STR_LIT:utf-8>')<EOL>if p.returncode == <NUM_LIT:0>:<EOL><INDENT>return json_decode(stdout) if parse_json else stdout<EOL><DEDENT>raise Exception(stderr if stderr else ('<STR_LIT>'.format(p.returncode)))<EOL>
run node command