ผมพบว่าหัวข้อนี้หัวข้อ: bug # 225549: มีนาฬิกาจอภาพ stderr ชุดข้อความนั้นมาจากปี 2008 แต่ดูเหมือนว่ารุ่นเก่าจะไม่รองรับการดูรายการอื่นนอกเหนือจาก STDOUT
ดังนั้นเราจึง จำกัด เพียงแค่ STDOUT สำหรับการมองเห็นมีภาษาจำนวนมากในinfo watchและman watchทำให้ฉันคิดว่าการสังเกต / การสันนิษฐานของคุณถูกต้อง
สิ่งที่สกัดมา
watch runs command repeatedly, displaying its output (the first screen‐
full). This allows you to watch the program output change over time.
By default, the program is run every 2 seconds; use -n or --interval to
specify a different interval.
บิตนี้ด้วย BUGS:
BUGS
Upon terminal resize, the screen will not be correctly repainted until
the next scheduled update. All --differences highlighting is lost on
that update as well.
ถ้าฉันต้องเดาว่าฉันคิดว่าพวกเขากำลังเก็บบิตที่มองเห็นได้ในบัฟเฟอร์ระหว่างการวิ่งแล้ววิเคราะห์ตัวละครเหล่านั้น
แก้ไข # 1
ฉันแก้จุดบกพร่องนี้เพิ่มเติมโดยใช้straceและคุณสามารถดูwatchการอ่านผลลัพธ์จากlsคำสั่งดังนั้นภายในวางการเปลี่ยนแปลง
ก่อนที่ฉันจะลบmไฟล์
$ strace -o w.log watch -g 'ls -1'
read(3, "a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\nl\nm\nn\nw.lo"..., 4096) = 34
close(3) = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
munmap(0x7f4da83af000, 4096) = 0
wait4(31011, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 31011
rt_sigaction(SIGTSTP, {SIG_IGN, [], SA_RESTORER|SA_RESTART, 0x7f4da79b94a0}, {0x7f4da7f81ee0, [], SA_RESTORER|SA_RESTART, 0x7f4da79b94a0}, 8) = 0
write(1, "\33[H\33[2JEvery 2.0s: ls -1\33[1;140H"..., 119) = 119
rt_sigaction(SIGTSTP, {0x7f4da7f81ee0, [], SA_RESTORER|SA_RESTART, 0x7f4da79b94a0}, NULL, 8) = 0
nanosleep({2, 0}, NULL) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=3519, ...}) = 0
pipe([3, 4]) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f4da839f9d0) = 31014
close(4) = 0
fcntl(3, F_GETFL) = 0 (flags O_RDONLY)
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4da83af000
lseek(3, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
read(3, "a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\nl\nm\nn\nw.lo"..., 4096) = 34
close(3) = 0
munmap(0x7f4da83af000, 4096) = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
หลังจากmไฟล์ถูกลบ
--- SIGCHLD (Child exited) @ 0 (0) ---
rt_sigaction(SIGTSTP, {SIG_IGN, [], SA_RESTORER|SA_RESTART, 0x7f4da79b94a0}, {0x7f4da7f81ee0, [], SA_RESTORER|SA_RESTART, 0x7f4da79b94a0}, 8) = 0
poll([{fd=0, events=POLLIN}], 1, 0) = 0 (Timeout)
poll([{fd=0, events=POLLIN}], 1, 0) = 0 (Timeout)
write(1, "\33[1;158H8\33[11;163H", 18) = 18
rt_sigaction(SIGTSTP, {0x7f4da7f81ee0, [], SA_RESTORER|SA_RESTART, 0x7f4da79b94a0}, NULL, 8) = 0
nanosleep({2, 0}, NULL) = 0
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=3519, ...}) = 0
pipe([3, 4]) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f4da839f9d0) = 31028
close(4) = 0
fcntl(3, F_GETFL) = 0 (flags O_RDONLY)
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4da83af000
lseek(3, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
read(3, "a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\nl\nn\nw.log\n", 4096) = 32
close(3) = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
munmap(0x7f4da83af000, 4096) = 0
wait4(31028, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 31028
-gเลือกที่จะwatchทำอย่างไร ฉันไม่พบมันในรุ่นของฉันwatch