-
-
Notifications
You must be signed in to change notification settings - Fork 813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make pre_cmd background forkable #557
Comments
I solved this issue by moving the command invocation into my
this refreshes the browser WITHOUT leaving neovim and losing focus from the IDE. feel free to close this issue if you are not interested in implementing a forkable pre_cmd for air. |
I have a similar solution for hot-reloading the code with air, but I used goroutines. refresh.sh
In my main.go file, I run the .sh file and the listen command as goroutines. main.go
The main drawback with this refresh command is that it will only refresh the current, visible tab. So it won't refresh the working page unless it's open. I wish there was a way to refresh the working tab even when it's not visible. |
for me this is ok since I only work with the browser page/tab open side by side to my neovim environment, so I can see the changes immediately when eg. working on the tailwindcss part. for now Im happy with this solution. |
Im trying to use
pre_cmd = ["/usr/bin/xdotool sleep 1 search --onlyvisible --classname Navigator windowactivate --sync key F5 &"]
to refresh the browser once the binary (golang echo framework) started. hence the sleep so the refresh happens after the http listening on the port is available.
I need to put the xdotool command into background
&
because otherwiseair
will wait for the command to finish and then run the webserver. which will obviously fail.I checked the code for the runner. it seems that forking into background exits the process immediately (the exec commad in utils_linux.go is "/bin/sh -c"...so ofc
air
wont wait and dismiss the command right away.so my question is:
any chance to implement a background forkable pre_cmd and the appropriate directive in air.toml?
The text was updated successfully, but these errors were encountered: