壳牌背景

壳牌上下文接口允许访问当前运行的 壳牌背景。你可以用它来获得通用的外壳选项。spring-doc.cadn.net.cn

InteractionMode 可以判断 shell 是在非交互模式下运行还是交互模式。spring-doc.cadn.net.cn

InteractionMode interactionMode = ctx.getInteractionMode();

Pty能判断当前终端是否有pty特征,而这并不一定是箱 当输出被导入文件或终端在CI系统中运行时。spring-doc.cadn.net.cn

boolean hasPty = ctx.hasPty();