MCPcopy Index your code
hub / github.com/codeaashu/claude-code / registerForeground

Function registerForeground

src/tasks/LocalShellTask/LocalShellTask.tsx:259–287  ·  view source on GitHub ↗
(input: LocalShellSpawnInput & {
  shellCommand: ShellCommand;
}, setAppState: SetAppState, toolUseId?: string)

Source from the content-addressed store, hash-verified

257 * @returns taskId for the registered task
258 */
259export function registerForeground(input: LocalShellSpawnInput & {
260 shellCommand: ShellCommand;
261}, setAppState: SetAppState, toolUseId?: string): string {
262 const {
263 command,
264 description,
265 shellCommand,
266 agentId
267 } = input;
268 const taskId = shellCommand.taskOutput.taskId;
269 const unregisterCleanup = registerCleanup(async () => {
270 killTask(taskId, setAppState);
271 });
272 const taskState: LocalShellTaskState = {
273 ...createTaskStateBase(taskId, 'local_bash', description, toolUseId),
274 type: 'local_bash',
275 status: 'running',
276 command,
277 completionStatusSentInAttachment: false,
278 shellCommand,
279 unregisterCleanup,
280 lastReportedTotalLines: 0,
281 isBackgrounded: false,
282 // Not yet backgrounded - running in foreground
283 agentId
284 };
285 registerTask(taskState, setAppState);
286 return taskId;
287}
288
289/**
290 * Background a specific foreground task.

Callers 2

runPowerShellCommandFunction · 0.85
runShellCommandFunction · 0.85

Calls 4

registerCleanupFunction · 0.85
killTaskFunction · 0.85
createTaskStateBaseFunction · 0.85
registerTaskFunction · 0.85

Tested by

no test coverage detected