micro-editor / micro-editor/micro
Jobs don't stay alive for JobSend
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 29.6k
- Forks
- 1.4k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 10
Description
This may be related to #1102, but I'm having trouble understanding how to use the JobSend function in plugins, if it is even possible. It seems possible to start jobs, and receive messages from them, but jobs that await info from stdin do not seem to stay alive long enough to do so.
Here's a minimal example that illustrates the problem. Suppose this is my init.lua:
function JobExit()
messenger:AddLog("job stopped")
end
function JobErr(s)
messenger:AddLog("stderr:" .. s)
end
function JobOut(s)
messenger:AddLog("stdout:" .. s)
end
function testJob()
testJ = JobStart('cat',
'init.JobOut',
'init.JobErr',
'init.JobExit'
)
messenger:AddLog("job started")
JobSend(testJ, "hello world")
end
function onViewOpen(view)
testJob()
end
Expected outcome in the log:
job started
stdout:hello world
Actual outcome:
job started
job stopped
The process just dies immediately. Of course, cat from the command line without input would not do this. Indeed, I cannot find a way to keep any job "alive" long enough to use JobSend at all. (And it's the same using JobSpawn instead of JobStart.)
I might just be missing something obvious. If so, my apologies.
Maybe this isn't the place to mention it, but I just wanted to note in passing that I love micro overall, even with these little hiccups. I've been looking for a simple, lightweight but extensible, modern and non-weird-and-vi-ish terminal editor for so long that I had almost given up. Such a wonderful thing to see.
Specifications
Commit hash: 2c219ba
OS: ArchLinux x86_64
Terminal: Kitty
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the minimal init.lua example with JobStart, JobSend, and then JobSpawn, observing the job and callback logs. Trace the plugin job entry points for those functions and determine why the process exits before stdin is consumed; done means a job waiting for stdin remains alive and produces the expected stdout and exit behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, lua
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100