MCPcopy Index your code
hub / github.com/open-cli-tools/concurrently / Command

Class Command

lib/command.ts:124–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122type CommandState = 'stopped' | 'started' | 'errored' | 'exited';
123
124export class Command implements CommandInfo {
125 private readonly killProcess: KillProcess;
126 private readonly spawn: SpawnCommand;
127 private readonly spawnOpts: SpawnOptions;
128 readonly index: number;
129
130 /** @inheritdoc */
131 readonly name: string;
132
133 /** @inheritdoc */
134 readonly command: string;
135
136 /** @inheritdoc */
137 readonly prefixColor?: string;
138
139 /** @inheritdoc */
140 readonly env: Record<string, unknown>;
141
142 /** @inheritdoc */
143 readonly cwd?: string;
144
145 /** @inheritdoc */
146 readonly ipc?: number;
147
148 readonly close = new Rx.Subject<CloseEvent>();
149 readonly error = new Rx.Subject<unknown>();
150 readonly stdout = new Rx.Subject<Buffer>();
151 readonly stderr = new Rx.Subject<Buffer>();
152 readonly timer = new Rx.Subject<TimerEvent>();
153
154 /**
155 * A stream of changes to the `#state` property.
156 *
157 * Note that the command never goes back to the `stopped` state, therefore it's not a value
158 * that's emitted by this stream.
159 */
160 readonly stateChange = new Rx.Subject<Exclude<CommandState, 'stopped'>>();
161 readonly messages = {
162 incoming: new Rx.Subject<MessageEvent>(),
163 outgoing: new Rx.ReplaySubject<OutgoingMessageEvent>(),
164 };
165
166 process?: ChildProcess;
167
168 // TODO: Should exit/error/stdio subscriptions be added here?
169 private subscriptions: readonly Rx.Subscription[] = [];
170 stdin?: Writable;
171 pid?: number;
172 killed = false;
173 exited = false;
174
175 state: CommandState = 'stopped';
176
177 constructor(
178 { index, name, command, prefixColor, env, cwd, ipc }: CommandInfo & { index: number },
179 spawnOpts: SpawnOptions,
180 spawn: SpawnCommand,
181 killProcess: KillProcess,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…