diff options
| author | Castor Regex <[email protected]> | 2025-08-25 11:49:30 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-08-25 11:49:30 -0500 |
| commit | 4f215037a1d89d638aed35ab6805b97128ba8876 (patch) | |
| tree | ec4d751cee821970ce10191b7847977138525ea6 | |
| parent | f5b923f18047646968389e60cf412486ba85bd9c (diff) | |
feat(editor): wait for ready file and rename to doEditor.go
| -rw-r--r-- | doEditor.go (renamed from editor.go) | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -5,9 +5,37 @@ import ( "os" "os/exec" "strings" + "time" + + "go.wit.com/log" ) -func doEditor() (string, error) { +func doEditor() error { + for { + filename, err := doEditorOnce() + if err != nil { + return err + } + log.Info("filename:", filename) + + for { + _, err := os.Stat("/tmp/regex.ready") + if err == nil { + break + } + time.Sleep(100 * time.Millisecond) + } + // read in regex.ready exists (should be SessionID) + // Println session ID + content, err := ioutil.ReadFile("/tmp/regex.ready") + if err != nil { + log.Error(err) + } + log.Infof("SessionID: %s", string(content)) + } +} + +func doEditorOnce() (string, error) { // Create a temporary file tmpfile, err := ioutil.TempFile("", "regex-*.txt") if err != nil { |
