profesorfalken / jPowerShell

Simple Java API to interact with PowerShell console
Apache License 2.0
218 stars 84 forks source link

New Methods for Script Execution #18

Closed Harinus closed 7 years ago

Harinus commented 7 years ago

Added methods for executing script from a BufferedReader. This is neccessary if you want to execute scripts that are bundled in a jar File (http://stackoverflow.com/a/8258308/3601364)

+executeScript(BufferedReader srcReader) +executeScript(BufferedReader srcReader, String params)

profesorfalken commented 7 years ago

Hello,

I do not have the time to check this PR right now but it looks great, as the one you have posted to handle the encoding. I will take a look in the next days.

Thanks

Harinus commented 7 years ago

Greetings profesorfalken,

is it possible to also include this PR in Version 1.8?

Best regards, Harinus

profesorfalken commented 7 years ago

Hello,

Yes I will include it in the 1.8 version but I does not plan to release it right now. Probably I will make some adjustements and add a test for the new methods. Do you want me to generate a quick snapshot version which includes your changes?

Regarding your modification, I think that it is easily optimizable if we do:

public PowerShellResponse executeScript(String scriptPath, String params) {
    [...] // Validations

    return executeScript(new BufferedReader(new FileReader(scriptToExecute)), params);
}

Anyway, I am on it. I will keep you updated.

profesorfalken commented 7 years ago

As said, I accept it and I will make some refactoring & add test.

Thank you again

Harinus commented 7 years ago

Thanks for the integration. The refactoring looks good. A snapshot would be great, so I can dispose my custom build and switch back to the mvn artifact. If I find some more bugs or useful enhancements I will inform you again.

profesorfalken commented 7 years ago

Hello again,

Finally I have decided that the code is ready for the 1.8 release so no need of a snapshot versoin. I have pushed it and il will be ready on Maven central in 1-2 hours from now.

Thanks you, best regards