detectShell static method

String detectShell()

Detect the current user's shell.

Implementation

static String detectShell() {
  // Check SHELL env var
  final shell = Platform.environment['SHELL'];
  if (shell != null && shell.isNotEmpty) {
    return shell.split('/').last;
  }
  // Fallback for Windows
  final comspec = Platform.environment['COMSPEC'];
  if (comspec != null) {
    return comspec.split(Platform.pathSeparator).last;
  }
  return Platform.isWindows ? 'cmd.exe' : 'sh';
}