Merge pull request #8746 from oni-link/fix.rpcstart2

Fix crash in channel_job_start() in combination with rpc and unknown command
This commit is contained in:
Björn Linse 2018-07-15 19:48:40 +02:00 committed by GitHub
commit c230ef24a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -288,7 +288,6 @@ Channel *channel_job_start(char **argv, CallbackReader on_stdout,
chan->on_stdout = on_stdout;
chan->on_stderr = on_stderr;
chan->on_exit = on_exit;
chan->is_rpc = rpc;
if (pty) {
if (detach) {
@ -326,7 +325,7 @@ Channel *channel_job_start(char **argv, CallbackReader on_stdout,
has_out = true;
has_err = false;
} else {
has_out = chan->is_rpc || callback_reader_set(chan->on_stdout);
has_out = rpc || callback_reader_set(chan->on_stdout);
has_err = callback_reader_set(chan->on_stderr);
}
int status = process_spawn(proc, true, has_out, has_err);
@ -347,7 +346,7 @@ Channel *channel_job_start(char **argv, CallbackReader on_stdout,
rstream_init(&proc->out, 0);
}
if (chan->is_rpc) {
if (rpc) {
// the rpc takes over the in and out streams
rpc_start(chan);
} else {