Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command-line arguments that are an empty string are discarded #1924

Closed
rzuckerm opened this issue Jan 20, 2024 · 0 comments · Fixed by #1925 or TheRenegadeCoder/sample-programs#3730
Closed

Comments

@rzuckerm
Copy link
Contributor

This can be demonstrated with this program:

using System;

namespace CommandLineBug;

class Program
{
    public static int Main(String[] args)
    {
        for (int count < args.Count)
        {
            Console.WriteLine($"Arg {count} = '{args[count]}'");
        }

        return 0;
    }
}

I compiled the program with tip version of Beef on a Ubuntu 22.04 Linux System. Here are some sample runs:

$ CommandLineBug/build/Debug_Linux64/CommandLineBug/CommandLineBug ""
$ CommandLineBug/build/Debug_Linux64/CommandLineBug/CommandLineBug "Hello" ""
Arg 0 = 'Hello'
$ CommandLineBug/build/Debug_Linux64/CommandLineBug/CommandLineBug "Hello" "" "There"
Arg 0 = 'Hello'
Arg 1 = 'There'
$ 

All of the above should show the empty command-line argument.

To give some context as to why I'd need to accept such a command line argument is due to the Roman Numeral project for the Sample Programs repository.

I will do a PR to fix this since I'm familiar with the C++ code that handles the command-line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant