Skip to content

Commit

Permalink
Return exit codes
Browse files Browse the repository at this point in the history
  • Loading branch information
orryverducci committed Feb 18, 2018
1 parent 7e554f0 commit 9f7cb53
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Release Notes
* **NEW:** Option to include subtitle pages in exported pages
* **IMPROVED:** Arguments provided in the wrong format are now handled more gracefully
* **IMPROVED:** Serially transmitted services are now fully supported
* **IMPROVED:** An exit code is now returned when an error has occurred
* **FIXED:** Subpages within a page are now exported in a single TTI file, resolving an issue with vbit2
* **FIXED:** TOP data pages and pages with subcode 3F7F are now decoded and outputted

Expand Down
12 changes: 10 additions & 2 deletions TtxFromTS/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ internal class Program
/// The entry point of the application.
/// </summary>
/// <param name="args">The command line arguments.</param>
internal static void Main(string[] args)
internal static int Main(string[] args)
{
// Parse command line arguments, and run application if successful
if (ParseArguments(args))
Expand Down Expand Up @@ -69,7 +69,7 @@ internal static void Main(string[] args)
catch (InvalidOperationException)
{
OutputError("The provided packet identifier is not a teletext service");
return;
return 3;
}
packetsProcessed++;
}
Expand All @@ -88,17 +88,25 @@ internal static void Main(string[] args)
Console.WriteLine($"Total number of packets: {packetsDecoded}");
Console.WriteLine($"Packets processed: {packetsProcessed}");
Console.WriteLine($"Pages decoded: {_teletextDecoder.TotalPages}");
// Output success exit code
return 0;
}
else if (packetsDecoded > 0)
{
OutputError("Invalid packet identifier provided");
return 4;
}
else
{
OutputError("Unable to process transport stream - please check it is a valid TS file");
return 5;
}
}
}
else
{
return -1;
}
}

/// <summary>
Expand Down

0 comments on commit 9f7cb53

Please sign in to comment.