jPowerShell icon indicating copy to clipboard operation
jPowerShell copied to clipboard

Implement java.io.Closeable in PowerShell class

Open Tuupertunut opened this issue 8 years ago • 5 comments

Suggestion: Implement java.io.Closeable in the PowerShell class to allow Java 7+ users to automatically close the powershell session with a try-with-resources statement.

Tuupertunut avatar Nov 22 '17 01:11 Tuupertunut

Hello,

Thanks for this smart suggestion. For the moment I would like to keep it compatible with Java 5+. Maybe in a future 2.0 version.

Best regards

profesorfalken avatar Jan 26 '18 12:01 profesorfalken

java.io.Closeable is available since Java 5 so it won't break compatibility. Only Java 7+ users can take advantage of the try-with-resources statement, but Java 5 users can still use this library the same way as before.

Tuupertunut avatar Jan 26 '18 15:01 Tuupertunut

Ups!, I forgot to add this to 2.0 version, sorry. I will include it in 2.1

profesorfalken avatar Mar 31 '18 07:03 profesorfalken

@profesorfalken Thanks for your share , the autoCloseable was enabled in 2.1 , one more question , Can we close PowerShell session manually?

LonnccGitHub avatar Sep 26 '18 09:09 LonnccGitHub

Hi @LonnccGitHub ,

Yes of course. You can call manually the method close()

Best regards

profesorfalken avatar Sep 26 '18 11:09 profesorfalken