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:
8
plink.c
8
plink.c
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user