[Ohrrpgce] [ohrrpgce/ohrrpgce] Mac: Importing scripts/launching HSpeak randomly doesn't work (#1145)

Ralph Versteegen notifications at github.com
Tue Aug 23 16:44:22 PDT 2022


I committed a 'fix' in r12173 but didn't close this issue. I don't know whether anyone continued to suffer this issue (I think both Kiefkrack and Ravancloak switched to Windows). However, looking back at it, I can't see how the 'fix' can possibly be correct. `spawn_and_wait` calls `system()` to run `Terminal_wrapper.sh` to run `osascript` which runs a script which starts `dummyscript###.sh`. Each of those are synchronous (excepting waiting for `dummyscript` to finish), but the fix assumes that they aren't. But if they aren't then there's a much bigger problem: `spawn_and_wait` would return before the program has finished.

Writing thoughts here because I can't test on a Mac on the moment, so I'm not going to replace the code.

Looking at `Terminal_wrapper.sh`:

```
tell application "Terminal"
    activate
    set mytab to do script "'$@'"
    delay 0.5
    repeat while mytab is busy
        delay 1
    end repeat
    close window 1
end tell
```

`activate` opens the program but doesn't wait for it (which seems to be a common source of problems). Maybe `mytab is busy` is false while Terminal/bash are still starting (because the tab doesn't exist yet), and take longer than 0.5s to start, and so the `do script` and `close window 1` commands are only acted on by Terminal after `osascript` has finished.

Looking at that error message, another possible issue is that the path to `dummyscript389.sh` is relative from the wrong current directory? However then this error should presumably always happen.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/ohrrpgce/ohrrpgce/issues/1145#issuecomment-1224997661
You are receiving this because you are subscribed to this thread.

Message ID: <ohrrpgce/ohrrpgce/issues/1145/1224997661 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20220823/d5c7f46e/attachment.htm>


More information about the Ohrrpgce mailing list