Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/helper/test-fake-ssh.c # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / helper / test-fake-ssh.c` 32 lines ยท 841 bytes Raw Blame History 1 #include "git-compat-util.h" 2 #include "run-command.h" 3 #include "strbuf.h" 4 5 int cmd_main(int argc, const char **argv) 6 { 7 const char *trash_directory = getenv("TRASH_DIRECTORY"); 8 struct strbuf buf = STRBUF_INIT; 9 FILE *f; 10 int i; 11 struct child_process cmd = CHILD_PROCESS_INIT; 12 13 /* First, print all parameters into $TRASH_DIRECTORY/ssh-output */ 14 if (!trash_directory) 15 die("Need a TRASH_DIRECTORY!"); 16 strbuf_addf(&buf, "%s/ssh-output", trash_directory); 17 f = fopen(buf.buf, "w"); 18 if (!f) 19 die("Could not write to %s", buf.buf); 20 strbuf_release(&buf); 21 for (i = 0; i < argc; i++) 22 fprintf(f, "%s%s", i > 0 ? " " : "", i > 0 ? argv[i] : "ssh:"); 23 fprintf(f, "\n"); 24 fclose(f); 25 26 /* Now, evaluate the *last* parameter */ 27 if (argc < 2) 28 return 0; 29 cmd.use_shell = 1; 30 strvec_push(&cmd.args, argv[argc - 1]); 31 return run_command(&cmd); 32 }