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

Redirect input #15

Open
EderBeldad opened this issue Sep 2, 2023 · 5 comments
Open

Redirect input #15

EderBeldad opened this issue Sep 2, 2023 · 5 comments

Comments

@EderBeldad
Copy link

Can't find a way to redirect input by using the configuration files. Is there a way?

I tried something like:

{
    "cmake": {
        "cmd": "cmake",
        "dap_name": "lldb",
        "target": "longest-palindrome",
        "build_dir": "build",
        "args": {
            "configure": ["-DCMAKE_EXPORT_COMPILE_COMMANDS=1"],
            "debug": ["<", "./sample-input.txt"]
        },
        "build_type": "Debug"
    }
}
@Shatur
Copy link
Owner

Shatur commented Sep 2, 2023

        "debug": ["<", "./sample-input.txt"]

Should it be "debug": [">", "./sample-input.txt"]?

@EderBeldad
Copy link
Author

Should it be "debug": [">", "./sample-input.txt"]?

That would redirect output, not input (and would also be a desirable feature!).

Ideally (imho) it should work as vscode. Although having stdin/stdout as extra parameters would also be convenient.

@Shatur
Copy link
Owner

Shatur commented Sep 2, 2023

Oh, I see. Makes sense, but not sure if it's possible.
I use Job API from plenary: https://github.com/nvim-lua/plenary.nvim/blob/master/lua/plenary/job.lua
If it does not support it, I can't fix it. I would suggest to open issue there.

@EderBeldad
Copy link
Author

Seems that it has support for it (kind of):

https://github.com/nvim-lua/plenary.nvim/blob/master/lua/plenary/job.lua#L667C17-L667C17

This allows for sending data into stdin after job has started. (It would require for the file to be opened, read, and sent into the job)

@Shatur
Copy link
Owner

Shatur commented Sep 2, 2023

Right, then we probably could add support for it by providing additional stdin parameter with paths.
And just use it in this function:

function runner.chain_commands(task_name, commands, module_config, addition_args, previous_job)

I currently busy at the moment, but if you would like to play with it - PRs are welcome.

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

No branches or pull requests

2 participants