1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Add a new back-end function to return the exit code of the remote

process. This is functional in SSH, and vestigial (just returns 0)
in the other three protocols. Plink's Windows exit code is now
determined by the remote process exit code, which should make it
more usable in scripting applications. Tested in both SSH1 and SSH2.

[originally from svn r1518]
This commit is contained in:
Simon Tatham
2001-12-29 15:31:42 +00:00
parent 02a926f6c1
commit ef885c78ca
6 changed files with 69 additions and 8 deletions

View File

@ -444,6 +444,7 @@ int main(int argc, char **argv)
SOCKET *sklist;
int skcount, sksize;
int connopen;
int exitcode;
char extra_portfwd[sizeof(cfg.portfwd)];
ssh_get_line = get_line;
@ -967,5 +968,10 @@ int main(int argc, char **argv)
break; /* we closed the connection */
}
WSACleanup();
return 0;
exitcode = back->exitcode();
if (exitcode < 0) {
fprintf(stderr, "Remote process exit code unavailable\n");
exitcode = 1; /* this is an error condition */
}
return exitcode;
}