MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / getBlockingCommand

Function getBlockingCommand

frontend/app/view/term/shellblocking.ts:75–117  ·  view source on GitHub ↗
(lastCommand: string | null, inAltBuffer: boolean)

Source from the content-addressed store, hash-verified

73}
74
75export function getBlockingCommand(lastCommand: string | null, inAltBuffer: boolean): string | null {
76 if (!lastCommand) return null;
77
78 let words = lastCommand.trim().split(/\s+/);
79 if (words.length === 0) return null;
80
81 while (words.length && WRAPPERS.includes(words[0])) {
82 words.shift();
83 }
84 if (!words.length) return null;
85
86 const first = words[0].split("/").pop()!;
87 const args = words.slice(1);
88
89 if (inAltBuffer) return first;
90
91 if (ALWAYS_BLOCK.includes(first)) return first;
92
93 if (isAttachLike(first, args)) return first;
94
95 if (first === "ssh" || first === "mosh" || first === "telnet" || first === "rlogin") {
96 if (isSshInteractive(args)) return first;
97 return null;
98 }
99
100 if (first === "su" || first === "machinectl" || first === "chroot" || first === "nsenter" || first === "lxc") {
101 if (!args.length || SHELLS.includes(args[args.length - 1]?.split("/").pop() || "")) return first;
102 return null;
103 }
104
105 if (SHELLS.includes(first)) {
106 if (looksInteractiveShellArgs(args)) return first;
107 if (isNonInteractiveShellExec(args)) return null;
108 return null;
109 }
110
111 if (BARE_REPLS.includes(first)) {
112 if (args.length === 0) return first;
113 return null;
114 }
115
116 return null;
117}

Callers 1

Calls 5

isAttachLikeFunction · 0.85
isSshInteractiveFunction · 0.85
popMethod · 0.80

Tested by

no test coverage detected