patch 9.1.0751: Error callback for term_start() not used

Problem:  Error callback for term_start() not used
          (darkseid-is)
Solution: attach pipe to stderr if an error callback exists

fixes: #15665
closes: #15729

Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/os_unix.c b/src/os_unix.c
index e77a4b2..0aa6f3c 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -5763,8 +5763,11 @@
 	    goto failed;
 	}
     }
+    // only create a pipe for the error fd, when either a callback has been setup
+    // or pty is not used (e.g. terminal uses pty by default)
     else if (!use_out_for_err && !use_null_for_err
-				      && pty_master_fd < 0 && pipe(fd_err) < 0)
+		&& (pty_master_fd < 0 || (options->jo_set & JO_ERR_CALLBACK))
+			    && pipe(fd_err) < 0)
 	goto failed;
 
     if (!use_null_for_in || !use_null_for_out || !use_null_for_err)