From 20d36f16d3e8e8b02c2406eec46369ad74f78cd2 Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Sat, 18 Jun 2016 07:41:27 -0700 Subject: fg: fix exit code (was 1 if success else 0) returning a C boolean for builtin_fg success was backwards --- src/builtin.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/builtin.cpp b/src/builtin.cpp index b445cdf0..17ee3cac 100644 --- a/src/builtin.cpp +++ b/src/builtin.cpp @@ -2586,7 +2586,7 @@ static int builtin_fg(parser_t &parser, io_streams_t &streams, wchar_t **argv) { streams.err.append_format(_(L"%ls: There are no suitable jobs\n"), argv[0]); } } else if (argv[2] != 0) { - // Specifying what more than one job to put to the foreground is a syntax error, we still + // Specifying more than one job to put to the foreground is a syntax error, we still // try to locate the job argv[1], since we want to know if this is an ambigous job // specification or if this is an malformed job id. wchar_t *endptr; @@ -2604,6 +2604,7 @@ static int builtin_fg(parser_t &parser, io_streams_t &streams, wchar_t **argv) { streams.err.append_format(_(L"%ls: Ambiguous job\n"), argv[0]); } else { streams.err.append_format(_(L"%ls: '%ls' is not a job\n"), argv[0], argv[1]); + } builtin_print_help(parser, streams, argv[0], streams.err); @@ -2653,7 +2654,7 @@ static int builtin_fg(parser_t &parser, io_streams_t &streams, wchar_t **argv) { job_continue(j, job_is_stopped(j)); } - return j != 0; + return j ? STATUS_BUILTIN_OK : STATUS_BUILTIN_ERROR; } /// Helper function for builtin_bg(). -- cgit v1.2.3