finalcmd = string(" timeout 3 /bin/sh -c")
+ string(" \" ( export TERM=dumb && cd ") + lastpath
+ string(" && ") + command
+ string(" && echo -n MYPWD= && pwd ) 2>&1")
+ string(" | iconv -c -s -f utf-8 -t gb2312 \" 2>&1");
popen(finalcmd.c_str(), "r");
當command = echo " '{(}'){{'’\"}} ",
會報錯誤:sh: 1: Syntax error: ")" unexpected
但在管道里重定向錯誤,也無法捕獲到這個錯誤。
請教怎么修改finalcmd?
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/280782.html
標籤:其他開發語言
上一篇:python的安裝問題
下一篇:求解怎么正確使用print
