2022-05-24 23:15:02 +00:00
|
|
|
local commander = require 'commander'
|
|
|
|
|
2023-01-20 23:07:42 +00:00
|
|
|
commander.register('fg', function(_, sinks)
|
2022-05-24 23:15:02 +00:00
|
|
|
local job = hilbish.jobs.last()
|
|
|
|
if not job then
|
2023-01-20 23:07:42 +00:00
|
|
|
sinks.out:writeln 'fg: no last job'
|
2022-05-24 23:15:02 +00:00
|
|
|
return 1
|
|
|
|
end
|
|
|
|
|
|
|
|
local err = job.foreground() -- waits for job; blocks
|
|
|
|
if err then
|
2023-01-20 23:07:42 +00:00
|
|
|
sinks.out:writeln('fg: ' .. err)
|
2022-05-24 23:15:02 +00:00
|
|
|
return 2
|
|
|
|
end
|
|
|
|
end)
|