Created
September 26, 2022 14:41
-
-
Save yoku0825/2629031b69c06377f4dd5b5dc7552ef3 to your computer and use it in GitHub Desktop.
mysqlコマンドラインクライアントって、自分の出力がパイプかどうかどうやって判定してるんだろ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ strace -e write /usr/mysql/8.0.30/bin/mysql -S /usr/mysql/8.0.30/data/mysql.sock -P 64080 --prompt="mysql80 \C> " -e "SELECT 1" | |
write(1, "+---+\n", 6+---+ | |
) = 6 | |
write(1, "| 1 |\n", 6| 1 | | |
) = 6 | |
write(1, "+---+\n", 6+---+ | |
) = 6 | |
write(1, "| 1 |\n", 6| 1 | | |
) = 6 | |
write(1, "+---+\n", 6+---+ | |
) = 6 | |
+++ exited with 0 +++ | |
$ strace -e write /usr/mysql/8.0.30/bin/mysql -S /usr/mysql/8.0.30/data/mysql.sock -P 64080 --prompt="mysql80 \C> " -e "SELECT 1" | cat | |
write(1, "1\n1\n", 41 | |
1 | |
) = 4 | |
+++ exited with 0 +++ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
パイプあり
パイプなし