Skip to content

Keyboard interrupt (SIGINT) during a shell.RunInteractiveShell call from a plugin stops the editor itself #2612

@Andriamanitra

Description

@Andriamanitra

Description of the problem or steps to reproduce

  1. Make a plugin that uses shell.RunInteractiveShell() in ~/.config/micro/plug/exectest/exectest.lua:
local micro = import("micro")
local config = import("micro/config")
local shell = import("micro/shell")

function init()
	config.MakeCommand("exec", exec, config.NoComplete)
end

function exec()
	shell.RunInteractiveShell("sh -c 'echo press ctrl+c && sleep 10'", true, false)
end
  1. Run the plugin (ctrl+e and type exec)
  2. Press ctrl+c during execution

I would expect this to stop the interactive shell and return to the file I was editing. What happens instead is it kills the entire micro-editor process. It looks like this is also not what the code for shell.RunInteractiveShell was intended to do:
https://github.com/zyedidia/micro/blob/c8c7ad57bde1188364c5ad187de508646b01a52e/internal/shell/shell.go#L103-L111

Version information

OS: Linux (OpenSUSE Tumbleweed)
Version: 0.0.0-unknown
Commit hash: c8c7ad5
Compiled on October 31, 2022

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions