Fossil SCM
Stderr of ssh subcommand goes is read by the main process now, instead of going to the console. Improved error messages following failure on ssh: sync.
Commit
fb156a12bfa2aefbca413f9b7affa2b299d5eefb28ab0d16e92e9c97e3e8a00a
Parent
857495ec92a521b…
2 files changed
+6
-1
+7
-3
+6
-1
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -525,11 +525,16 @@ | ||
| 525 | 525 | } |
| 526 | 526 | return rc; |
| 527 | 527 | }else{ |
| 528 | 528 | /* The problem could not be corrected by retrying. Report the |
| 529 | 529 | ** the error. */ |
| 530 | - fossil_warning("server did not reply"); | |
| 530 | + if( g.url.isSsh && !g.fSshTrace ){ | |
| 531 | + fossil_warning("server did not reply: " | |
| 532 | + " rerun with --sshtrace for diagnostics"); | |
| 533 | + }else{ | |
| 534 | + fossil_warning("server did not reply"); | |
| 535 | + } | |
| 531 | 536 | goto write_err; |
| 532 | 537 | } |
| 533 | 538 | } |
| 534 | 539 | if( rc!=200 ){ |
| 535 | 540 | fossil_warning("\"location:\" missing from %d redirect reply", rc); |
| 536 | 541 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -525,11 +525,16 @@ | |
| 525 | } |
| 526 | return rc; |
| 527 | }else{ |
| 528 | /* The problem could not be corrected by retrying. Report the |
| 529 | ** the error. */ |
| 530 | fossil_warning("server did not reply"); |
| 531 | goto write_err; |
| 532 | } |
| 533 | } |
| 534 | if( rc!=200 ){ |
| 535 | fossil_warning("\"location:\" missing from %d redirect reply", rc); |
| 536 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -525,11 +525,16 @@ | |
| 525 | } |
| 526 | return rc; |
| 527 | }else{ |
| 528 | /* The problem could not be corrected by retrying. Report the |
| 529 | ** the error. */ |
| 530 | if( g.url.isSsh && !g.fSshTrace ){ |
| 531 | fossil_warning("server did not reply: " |
| 532 | " rerun with --sshtrace for diagnostics"); |
| 533 | }else{ |
| 534 | fossil_warning("server did not reply"); |
| 535 | } |
| 536 | goto write_err; |
| 537 | } |
| 538 | } |
| 539 | if( rc!=200 ){ |
| 540 | fossil_warning("\"location:\" missing from %d redirect reply", rc); |
| 541 |
+7
-3
| --- src/popen.c | ||
| +++ src/popen.c | ||
| @@ -129,19 +129,18 @@ | ||
| 129 | 129 | FILE **ppOut, /* Write to child using this file descriptor */ |
| 130 | 130 | int *pChildPid, /* PID of the child process */ |
| 131 | 131 | int bDirect /* 0: run zCmd as a shell cmd. 1: run directly */ |
| 132 | 132 | ){ |
| 133 | 133 | #ifdef _WIN32 |
| 134 | - HANDLE hStdinRd, hStdinWr, hStdoutRd, hStdoutWr, hStderr; | |
| 134 | + HANDLE hStdinRd, hStdinWr, hStdoutRd, hStdoutWr; | |
| 135 | 135 | SECURITY_ATTRIBUTES saAttr; |
| 136 | 136 | DWORD childPid = 0; |
| 137 | 137 | int fd; |
| 138 | 138 | |
| 139 | 139 | saAttr.nLength = sizeof(saAttr); |
| 140 | 140 | saAttr.bInheritHandle = TRUE; |
| 141 | 141 | saAttr.lpSecurityDescriptor = NULL; |
| 142 | - hStderr = GetStdHandle(STD_ERROR_HANDLE); | |
| 143 | 142 | if( !CreatePipe(&hStdoutRd, &hStdoutWr, &saAttr, 4096) ){ |
| 144 | 143 | win32_fatal_error("cannot create pipe for stdout"); |
| 145 | 144 | } |
| 146 | 145 | SetHandleInformation( hStdoutRd, HANDLE_FLAG_INHERIT, FALSE); |
| 147 | 146 | |
| @@ -149,11 +148,16 @@ | ||
| 149 | 148 | win32_fatal_error("cannot create pipe for stdin"); |
| 150 | 149 | } |
| 151 | 150 | SetHandleInformation( hStdinWr, HANDLE_FLAG_INHERIT, FALSE); |
| 152 | 151 | |
| 153 | 152 | win32_create_child_process(fossil_utf8_to_unicode(zCmd), |
| 154 | - hStdinRd, hStdoutWr, hStderr,&childPid); | |
| 153 | + hStdinRd,hStdoutWr,hStdoutWr,&childPid); | |
| 154 | + /* ^^^^^^^^^ ^^^^^^^^^ | |
| 155 | + ** Send both stdout and stderr to to *ppOut. | |
| 156 | + ** See check-in 857495ec92a521bb (2024-02-06) and earlier for | |
| 157 | + ** an example of how to leave stderr going to console */ | |
| 158 | + | |
| 155 | 159 | *pChildPid = childPid; |
| 156 | 160 | *pfdIn = _open_osfhandle(PTR_TO_INT(hStdoutRd), 0); |
| 157 | 161 | fd = _open_osfhandle(PTR_TO_INT(hStdinWr), 0); |
| 158 | 162 | *ppOut = _fdopen(fd, "w"); |
| 159 | 163 | CloseHandle(hStdinRd); |
| 160 | 164 |
| --- src/popen.c | |
| +++ src/popen.c | |
| @@ -129,19 +129,18 @@ | |
| 129 | FILE **ppOut, /* Write to child using this file descriptor */ |
| 130 | int *pChildPid, /* PID of the child process */ |
| 131 | int bDirect /* 0: run zCmd as a shell cmd. 1: run directly */ |
| 132 | ){ |
| 133 | #ifdef _WIN32 |
| 134 | HANDLE hStdinRd, hStdinWr, hStdoutRd, hStdoutWr, hStderr; |
| 135 | SECURITY_ATTRIBUTES saAttr; |
| 136 | DWORD childPid = 0; |
| 137 | int fd; |
| 138 | |
| 139 | saAttr.nLength = sizeof(saAttr); |
| 140 | saAttr.bInheritHandle = TRUE; |
| 141 | saAttr.lpSecurityDescriptor = NULL; |
| 142 | hStderr = GetStdHandle(STD_ERROR_HANDLE); |
| 143 | if( !CreatePipe(&hStdoutRd, &hStdoutWr, &saAttr, 4096) ){ |
| 144 | win32_fatal_error("cannot create pipe for stdout"); |
| 145 | } |
| 146 | SetHandleInformation( hStdoutRd, HANDLE_FLAG_INHERIT, FALSE); |
| 147 | |
| @@ -149,11 +148,16 @@ | |
| 149 | win32_fatal_error("cannot create pipe for stdin"); |
| 150 | } |
| 151 | SetHandleInformation( hStdinWr, HANDLE_FLAG_INHERIT, FALSE); |
| 152 | |
| 153 | win32_create_child_process(fossil_utf8_to_unicode(zCmd), |
| 154 | hStdinRd, hStdoutWr, hStderr,&childPid); |
| 155 | *pChildPid = childPid; |
| 156 | *pfdIn = _open_osfhandle(PTR_TO_INT(hStdoutRd), 0); |
| 157 | fd = _open_osfhandle(PTR_TO_INT(hStdinWr), 0); |
| 158 | *ppOut = _fdopen(fd, "w"); |
| 159 | CloseHandle(hStdinRd); |
| 160 |
| --- src/popen.c | |
| +++ src/popen.c | |
| @@ -129,19 +129,18 @@ | |
| 129 | FILE **ppOut, /* Write to child using this file descriptor */ |
| 130 | int *pChildPid, /* PID of the child process */ |
| 131 | int bDirect /* 0: run zCmd as a shell cmd. 1: run directly */ |
| 132 | ){ |
| 133 | #ifdef _WIN32 |
| 134 | HANDLE hStdinRd, hStdinWr, hStdoutRd, hStdoutWr; |
| 135 | SECURITY_ATTRIBUTES saAttr; |
| 136 | DWORD childPid = 0; |
| 137 | int fd; |
| 138 | |
| 139 | saAttr.nLength = sizeof(saAttr); |
| 140 | saAttr.bInheritHandle = TRUE; |
| 141 | saAttr.lpSecurityDescriptor = NULL; |
| 142 | if( !CreatePipe(&hStdoutRd, &hStdoutWr, &saAttr, 4096) ){ |
| 143 | win32_fatal_error("cannot create pipe for stdout"); |
| 144 | } |
| 145 | SetHandleInformation( hStdoutRd, HANDLE_FLAG_INHERIT, FALSE); |
| 146 | |
| @@ -149,11 +148,16 @@ | |
| 148 | win32_fatal_error("cannot create pipe for stdin"); |
| 149 | } |
| 150 | SetHandleInformation( hStdinWr, HANDLE_FLAG_INHERIT, FALSE); |
| 151 | |
| 152 | win32_create_child_process(fossil_utf8_to_unicode(zCmd), |
| 153 | hStdinRd,hStdoutWr,hStdoutWr,&childPid); |
| 154 | /* ^^^^^^^^^ ^^^^^^^^^ |
| 155 | ** Send both stdout and stderr to to *ppOut. |
| 156 | ** See check-in 857495ec92a521bb (2024-02-06) and earlier for |
| 157 | ** an example of how to leave stderr going to console */ |
| 158 | |
| 159 | *pChildPid = childPid; |
| 160 | *pfdIn = _open_osfhandle(PTR_TO_INT(hStdoutRd), 0); |
| 161 | fd = _open_osfhandle(PTR_TO_INT(hStdinWr), 0); |
| 162 | *ppOut = _fdopen(fd, "w"); |
| 163 | CloseHandle(hStdinRd); |
| 164 |