Skip to content

MultiItemSelector and SingleItemSelector run not prompting user and returning immediately on Windows 11 #1015

@simonhillairetsrai

Description

@simonhillairetsrai

This issue occurs on Windows 11, using Windows command line cmd.exe.

Spring-shell version: 3.2.2

Based on the example provided in version 3.2.2 of the documentation:

https://docs.spring.io/spring-shell/reference/components/ui/multiselect.html

@ShellComponent
public class ComponentCommands extends AbstractShellComponent {

	@ShellMethod(key = "component multi", value = "Multi selector", group = "Components")
	public String multiSelector() {
		List<SelectorItem<String>> items = new ArrayList<>();
		items.add(SelectorItem.of("key1", "value1"));
		items.add(SelectorItem.of("key2", "value2", false, true));
		items.add(SelectorItem.of("key3", "value3"));
		MultiItemSelector<String, SelectorItem<String>> component = new MultiItemSelector<>(getTerminal(),
				items, "testSimple", null);
		component.setResourceLoader(getResourceLoader());
		component.setTemplateExecutor(getTemplateExecutor());
		MultiItemSelectorContext<String, SelectorItem<String>> context = component
				.run(MultiItemSelectorContext.empty());
		String result = context.getResultItems().stream()
				.map(si -> si.getItem())
				.collect(Collectors.joining(","));
		return "Got value " + result;
	}
}

When calling this command, the user is not prompted to select a value and context.getResultItems() returns null immediatly.

The same issue occurs with SingleItemSelector:

https://stackoverflow.com/questions/77335253/spring-shell-singleitemselector-not-working-in-windows-console-but-fine-in-ubu

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions