@special_command('<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>')<EOL>def execute_system_command(arg, **_):
usage = "<STR_LIT>"<EOL>if not arg:<EOL><INDENT>return [(None, None, None, usage)]<EOL><DEDENT>try:<EOL><INDENT>command = arg.strip()<EOL>if command.startswith('<STR_LIT>'):<EOL><INDENT>ok, error_message = handle_cd_command(arg)<EOL>if not ok:<EOL><INDENT>return [(None, None, None, error_message)]<EOL><DEDENT>return [(None, None, None, '<STR_LIT>')]<EOL><DEDENT>args = arg.split('<STR_LIT:U+0020>')<EOL>process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)<EOL>output, error = process.communicate()<EOL>response = output if not error else error<EOL>if isinstance(response, bytes):<EOL><INDENT>encoding = locale.getpreferredencoding(False)<EOL>response = response.decode(encoding)<EOL><DEDENT>return [(None, None, None, response)]<EOL><DEDENT>except OSError as e:<EOL><INDENT>return [(None, None, None, '<STR_LIT>' % e.strerror)]<EOL><DEDENT>
Execute a system shell command.