aboutsummaryrefslogtreecommitdiff
path: root/interactive.go
diff options
context:
space:
mode:
Diffstat (limited to 'interactive.go')
-rw-r--r--interactive.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/interactive.go b/interactive.go
index 1c9ca71..1baa4cc 100644
--- a/interactive.go
+++ b/interactive.go
@@ -26,7 +26,6 @@ import (
26 "os" 26 "os"
27 "path" 27 "path"
28 "strings" 28 "strings"
29 "time"
30) 29)
31 30
32func watch(dirPath string, watcher *fsnotify.Watcher) *fsnotify.Watcher { 31func watch(dirPath string, watcher *fsnotify.Watcher) *fsnotify.Watcher {
@@ -107,21 +106,21 @@ func interactive(sourceDir, outputDir string, exts []string, saveAs string) {
107 if fcmd.IsDir(ev.Name) { 106 if fcmd.IsDir(ev.Name) {
108 elements := parseParents(ev.Name, sourceDir, exts) 107 elements := parseParents(ev.Name, sourceDir, exts)
109 dirPath := path.Join(sourceDir, strings.TrimPrefix(ev.Name, sourceDir)) 108 dirPath := path.Join(sourceDir, strings.TrimPrefix(ev.Name, sourceDir))
109 wait.Add(2)
110 go compile(dirPath, elements, sourceDir, outputDir, saveAs, exts, true) 110 go compile(dirPath, elements, sourceDir, outputDir, saveAs, exts, true)
111 go copyFiles(dirPath, sourceDir, outputDir, exts, true) 111 go copyFiles(dirPath, sourceDir, outputDir, exts, true)
112 } else { 112 } else {
113 dirPath := path.Join(sourceDir, strings.TrimPrefix(dir, sourceDir)) 113 dirPath := path.Join(sourceDir, strings.TrimPrefix(dir, sourceDir))
114 if isParsable(path.Ext(ev.Name), exts) { 114 if isParsable(path.Ext(ev.Name), exts) {
115 elements := parseParents(dir, sourceDir, exts) 115 elements := parseParents(dir, sourceDir, exts)
116 wait.Add(1)
116 go compile(dirPath, elements, sourceDir, outputDir, saveAs, exts, true) 117 go compile(dirPath, elements, sourceDir, outputDir, saveAs, exts, true)
117 } 118 }
119 wait.Add(1)
118 go copyFiles(dirPath, sourceDir, outputDir, exts, false) 120 go copyFiles(dirPath, sourceDir, outputDir, exts, false)
119 } 121 }
120 } 122 }
121 123
122 // sleep some milliseconds to prevent early exit
123 time.Sleep(time.Millisecond * 100)
124
125 // wait until all tasks are completed 124 // wait until all tasks are completed
126 wait.Wait() 125 wait.Wait()
127 126