os#userInfo TypeScript Examples

The following examples show how to use os#userInfo. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: fixPath.ts    From TidGi-Desktop with Mozilla Public License 2.0 6 votes vote down vote up
defaultShell = (() => {
  const { env, platform } = process;
  if (platform === 'win32') {
    return env.COMSPEC ?? 'cmd.exe';
  }
  try {
    const { shell } = userInfo();
    if (shell !== undefined) {
      return shell;
    }
  } catch {}
  if (platform === 'darwin') {
    return env.SHELL ?? '/bin/zsh';
  }
  return env.SHELL ?? '/bin/sh';
})()
Example #2
Source File: telemetry.ts    From vscode-recall with MIT License 5 votes vote down vote up
/**
   * replace username with anon
   */
  anonymizePaths(input: string) {
    // tslint:disable-next-line:triple-equals
    if (input == null) return input;
    return input.replace(new RegExp('\\' + sep + userInfo().username, 'g'), sep + 'anon');
  }