src/vs/workbench/contrib/debug/node/terminals.ts/hasChildProcesses
export function hasChildProcesses(processId: number | undefined): Promise<boolean> {
	if (processId) {

		// if shell has at least one child process, assume that shell is busy
		if (platform.isWindows) {
			return new Promise<boolean>(async (resolve) => {
				// See #123296
				const windowsProcessTree = await import('windows-process-tree');
				windowsProcessTree.getProcessTree(processId, (processTree) => {
					resolve(processTree.children.length > 0);
				});
			});
		} else {
			return spawnAsPromised('/usr/bin/pgrep', ['-lP', String(processId)]).then(stdout => {
				const r = stdout.trim();
				if (r.length === 0 || r.indexOf(' tmux') >= 0) { // ignore 'tmux'; see #43683
					return false;
				} else {
					return true;
				}
			}, error => {
				return true;
			});
		}
	}
	// fall back to safe side
	return Promise.resolve(true);
}