[{"data":1,"prerenderedAt":126},["ShallowReactive",2],{"posts:\u002Fposts\u002F2022-04-09-rust-compile-watcher-util":3},{"id":4,"title":5,"body":6,"categories":111,"date":113,"description":114,"extension":115,"image":114,"lang":114,"meta":116,"navigation":117,"path":118,"seo":119,"stem":120,"tags":121,"titleInPicture":124,"__hash__":125},"posts\u002Fposts\u002F2022-04-09-rust-compile-watcher-util.md","Rust compile watcher util",{"type":7,"value":8,"toc":108},"minimark",[9,13,18,21,104],[10,11,12],"p",{},"Run a command whenever a file within a folder is modified.",[14,15,17],"h2",{"id":16},"code","Code",[10,19,20],{},"watch-rust.sh",[22,23,28],"pre",{"className":24,"code":25,"language":26,"meta":27,"style":27},"language-sh shiki shiki-themes github-dark","# in this case .\u002Fsrc is the path to watch. Don't point it to a big folder.\ninotifywait -r -e modify .\u002Fsrc | \n   while read selectedpath _ file; do \n       echo $selectedpath$file modified\n       # the command to run on change\n       . .\u002Frecompile-rust.sh\n       # a sort of \"debouncing\" technique\n       echo \"sleep 1\";\n       sleep 1\n       echo \"reestablish watch\";\n       . .\u002Fwatch-rust.sh\n   done\n","sh","",[16,29,30,38,44,50,56,62,68,74,80,86,92,98],{"__ignoreMap":27},[31,32,35],"span",{"class":33,"line":34},"line",1,[31,36,37],{},"# in this case .\u002Fsrc is the path to watch. Don't point it to a big folder.\n",[31,39,41],{"class":33,"line":40},2,[31,42,43],{},"inotifywait -r -e modify .\u002Fsrc | \n",[31,45,47],{"class":33,"line":46},3,[31,48,49],{},"   while read selectedpath _ file; do \n",[31,51,53],{"class":33,"line":52},4,[31,54,55],{},"       echo $selectedpath$file modified\n",[31,57,59],{"class":33,"line":58},5,[31,60,61],{},"       # the command to run on change\n",[31,63,65],{"class":33,"line":64},6,[31,66,67],{},"       . .\u002Frecompile-rust.sh\n",[31,69,71],{"class":33,"line":70},7,[31,72,73],{},"       # a sort of \"debouncing\" technique\n",[31,75,77],{"class":33,"line":76},8,[31,78,79],{},"       echo \"sleep 1\";\n",[31,81,83],{"class":33,"line":82},9,[31,84,85],{},"       sleep 1\n",[31,87,89],{"class":33,"line":88},10,[31,90,91],{},"       echo \"reestablish watch\";\n",[31,93,95],{"class":33,"line":94},11,[31,96,97],{},"       . .\u002Fwatch-rust.sh\n",[31,99,101],{"class":33,"line":100},12,[31,102,103],{},"   done\n",[105,106,107],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":27,"searchDepth":40,"depth":40,"links":109},[110],{"id":16,"depth":40,"text":17},[112],"blog","2022-04-09",null,"md",{},true,"\u002Fposts\u002F2022-04-09-rust-compile-watcher-util",{"title":5,"description":12},"posts\u002F2022-04-09-rust-compile-watcher-util",[122,123],"gist","linux",false,"GH9oSEQyF2-O_cfZg-q7F1FfEw4GTGhvgxqD22t5Iuc",1790978019183]