Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d57b65f

Browse files
committed
Wait for ssh process completion in fio_disconnect
1 parent abfb2b5 commit d57b65f

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/pg_probackup.h

+1
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ extern bool in_backup_list(parray *backup_list, pgBackup *target_backup);
577577
extern int get_backup_index_number(parray *backup_list, pgBackup *backup);
578578
extern bool launch_agent(void);
579579
extern void launch_ssh(char* argv[]);
580+
extern void wait_ssh(void);
580581

581582
#define COMPRESS_ALG_DEFAULT NOT_DEFINED_COMPRESS
582583
#define COMPRESS_LEVEL_DEFAULT 1

src/utils/file.c

+1
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ fio_disconnect(void)
344344
SYS_CHECK(close(fio_stdout));
345345
fio_stdin = 0;
346346
fio_stdout = 0;
347+
wait_ssh();
347348
}
348349
}
349350

src/utils/remote.c

+9
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,22 @@ static int split_options(int argc, char* argv[], int max_options, char* options)
5353
}
5454

5555
static int child_pid;
56+
5657
#if 0
5758
static void kill_child(void)
5859
{
5960
kill(child_pid, SIGTERM);
6061
}
6162
#endif
6263

64+
65+
void wait_ssh(void)
66+
{
67+
int status;
68+
waitpid(child_pid, &status, 0);
69+
elog(LOG, "SSH process %d is terminated with status %d", child_pid, status);
70+
}
71+
6372
#ifdef WIN32
6473
void launch_ssh(char* argv[])
6574
{

0 commit comments

Comments
 (0)