fix: echo should not read stdin (Unix semantics)
This commit is contained in:
@ -13,10 +13,9 @@ class THEcho(TextHandler):
|
|||||||
async def handle(
|
async def handle(
|
||||||
self, env: TextHandlerEnvironment, istream: str | None, args: list[str]
|
self, env: TextHandlerEnvironment, istream: str | None, args: list[str]
|
||||||
) -> TextHandleResult:
|
) -> TextHandleResult:
|
||||||
if len(args) == 0 and istream is None:
|
# echo 不读 stdin,只输出参数(Unix 语义)
|
||||||
|
if len(args) == 0:
|
||||||
return TextHandleResult(1, "请在 echo 后面添加需要输出的文本")
|
return TextHandleResult(1, "请在 echo 后面添加需要输出的文本")
|
||||||
if istream is not None:
|
|
||||||
return TextHandleResult(0, "\n".join([istream] + args))
|
|
||||||
return TextHandleResult(0, "\n".join(args))
|
return TextHandleResult(0, "\n".join(args))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user