Skip to content

Commit

Permalink
Bugfix: more reliable F9 'make' in background
Browse files Browse the repository at this point in the history
  • Loading branch information
Tero Karvinen committed Nov 2, 2022
1 parent 3392fed commit ce60e3c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
13 changes: 9 additions & 4 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ function runitCommand(bp) -- bp BufPane
shell.RunInteractiveShell(cmd, true, false)
end

function makeJobExit(out, args)
local out = string.sub(out, -79)
out = string.gsub(out, "\n", " ")
micro.InfoBar():Message("'make' done: ...", out)
end

function makeup(bg)
-- Go up directories until a Makefile is found and run 'make'.

Expand Down Expand Up @@ -75,12 +81,11 @@ function makeup(bg)
if err ~= nil then
micro.InfoBar():Message("(not found in ", pwd, ")")
else
micro.InfoBar():Message("Running make, found Makefile in ", pwd)
if bg then
local outfunc, err = shell.RunBackgroundShell("make")
-- local out = string.sub(outfunc(), -60) -- this will block, can't edit when blocking
-- micro.InfoBar():Message("'make' done: ", out)
micro.InfoBar():Message("Background running make, found Makefile in ", pwd)
shell.JobStart("make", nil, nil, makeJobExit, nil)
else
micro.InfoBar():Message("Running make, found Makefile in ", pwd)
local out, err = shell.RunInteractiveShell("make", true, true)
end
return
Expand Down
7 changes: 7 additions & 0 deletions repo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
"Website": "https://github.com/terokarvinen/micro-run",
"Tags": ["run", "execute", "Go", "Python", "Bash", "Lua", "F5"],
"Versions": [
{
"Version": "0.0.7",
"Url": "https://github.com/terokarvinen/micro-run/archive/v0.0.7.zip",
"Require": {
"micro": ">=2.0.0"
}
},
{
"Version": "0.0.6",
"Url": "https://github.com/terokarvinen/micro-run/archive/v0.0.6.zip",
Expand Down

0 comments on commit ce60e3c

Please sign in to comment.