identifyShell method

Shell identifyShell()

Attempts to identify the shell that DCli was run under. Ignores the 'sh' instances used by #! to start a DCli script.

If we can't find a known shell we will return UnknownShell. If the 'sh' instance created by #! is the only known shell we detect then we will return that shell ShShell.

Currently this isn't very reliable.

Implementation

Shell identifyShell() {
  /// on posix systems this MAY give us the login shell name.
  final loginShell = ShellMixin.loginShell();
  if (loginShell != null) {
    return _shellByName(loginShell, -1);
  } else {
    return _searchProcessTree();
  }
}