tvl-depot/tools/gerrit-cli.nix
Griffin Smith 18994b9c58 fix(tools/gerrit-cli): Don't wrap ssh sniffing in a subshell
This was actually executing ssh, which was kinda silly - we really just
want to check the return code of the `which` invocation

Change-Id: I8a4b277a2be3b0c6a43d2da830cb82a32f9ee51e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/428
Reviewed-by: tazjin <mail@tazj.in>
2020-06-16 15:43:28 +00:00

13 lines
380 B
Nix

# Utility script to run a gerrit command on the depot host via ssh.
# Reads the username from TVL_USERNAME, or defaults to $(whoami)
{ pkgs, ... }:
pkgs.writeShellScriptBin "gerrit" ''
TVL_USERNAME=''${TVL_USERNAME:-$(whoami)}
if which ssh 2>/dev/null; then
ssh=ssh
else
ssh="${pkgs.openssh}/bin/ssh"
fi
$ssh $TVL_USERNAME@code.tvl.fyi -p 29418 -- gerrit $@
''