Skip to content

launcher.bat could not pass on redirected input into the java program being debugged #756

Closed
microsoft/vscode-java-debug
#1077

Description

@Nibikibaba

If a developer would like to redirect a file as stdin to a java program to be debugged, one would set up a launch config in launch.json like this:

...
{
  ...
  "console": "integratedTerminal",
  "args": ["<", "input.txt"]
}

While integratedTerminal indeed preserved the < input.txt and passed it on unmodified, input.txt in the above example is redirected to launcher.bat as its stdin, instead of stdin for the java program to be launched.

A quick fix would be to replace the %* line in launcher.bat by more | %* so that data streamed into stdin of launcher.bat would be piped into the java program being launched using the more program. Unfortunately, more would treat input as text and modify line breaks. It would be better if the developers of this extension could fix this issue properly, by perhaps NOT using an intermediate launcher.bat script (which only perform one additional function which is the changing of code-page) but directly launch the java program with input redirection specified in the "args" array performed on the java program directly.

Activity

  1. Eskibear commented on Sep 26, 2021

    @Eskibear
    Member

    launcher.bat was introduced as a workaround to mitigate encoding issue, but with some side effects. It's on our plan to solve encoding problems in a more systematic way, and I believe we will also remove launcher.bat in coming versions.

    See:
    microsoft/vscode-java-debug#622 (comment)
    #720 (comment)

  2. Nibikibaba commented on Sep 27, 2021

    @Nibikibaba
    Author

    Yes it is pretty clear what the launcher.bat is for. However, we in Redmond don't normally refer to bugs as "side effects" :-)

    Losing the ability to debug redirected standard input could be quite a headache for students -- programming exercises often supply input data through stdin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions