I am writing a shell, within the shell I am using the fflush(stdout) function to output the last typed character to the prompt line while continuing to read the input.
This only becomes an issue when running on linux though, I am able to compile and run the same code fine on macOS.
To resolve the issue for the moment I call fflush(nil) to just flush all the available output streams, but I would rather do this another way if possible.
I am running this on swift 6.2.
Here is the repository and the line it was being used originally: Swell/Swell/IO/RawPromptHandler.swift at 559793ce9adc78dca615d932beee91211061c398 · MauriceElliott/Swell · GitHub and Swell/Swell/main.swift at 559793ce9adc78dca615d932beee91211061c398 · MauriceElliott/Swell · GitHub
This is how I’ve resolved it: Swell/Sources/IO/FlushWrapper.swift at main · MauriceElliott/Swell · GitHub and Swell/Sources/IO/PromptHandler.swift at 7df3e86ace13f9f73d95fd00f7f32facb6ba89dd · MauriceElliott/Swell · GitHub
Any other details required don’t hesistate to ask, if anyone that owns and runs linux on maybe just a supported distro (I am using Gentoo which isn’t technically supported by Swiftly?) could just confirm that references to stdout throw the same error that would be great.
Any support or advice in any regard would be helpful, so no pressure to provide answers, just want to know if I’m doing something completely wrong instead?