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
|
|
|
|
|
2023-02-19 19:11:55 +00:00
|
|
|
local err = job:foreground() -- waits for job; blocks
|
2022-05-24 23:15:02 +00:00
|
|
|
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)
|