liwenhe1993 opened a new issue #2015: [Feature] Support worker server to run bat script URL: https://github.com/apache/incubator-dolphinscheduler/issues/2015 Run a program or script as another user, there is `sudo -u` in Unix-like, but there is no `sudo -u` command in Windows, the nearest equivalent is `runas` command. ***But can't pipe a password into runas, because it requests the password `from the terminal`, `not from stdin`.*** So, I have to reimplement `ProcessImpl.java`, `ProcessEnvironment.java` and `ProcessBuilder.java` for Windows. **First, for Windows, I will reimplement it by `JNA`:** > `ProcessBuilder.java`: *copy and rewrite it* > `ProcessEnvironment.java`: *rewrrite it by `JNA`* > ```java > private static native String environmentBlock(); > ``` > `ProcessImpl.java`: *rewrrite it by `JNA`* > ```java > private static native int getStillActive(); > private static native int getExitCodeProcess(long handle); > private static native void waitForInterruptibly(long handle); > private static native void waitForTimeoutInterruptibly(long handle, long timeout); > private static native void terminateProcess(long handle); > private static native boolean isProcessAlive(long handle); > private static synchronized native long create(String cmdstr, String envblock, String dir, long[] stdHandles, boolean redirectErrorStream) > private static native long openForAtomicAppend(String path) throws IOException; > private static native boolean closeHandle(long handle); > ``` **Finally, I will create new file in ds, like `ProcessBuilderForWin32.java`, `ProcessEnvironmentForWin32.java`, `ProcessImplForWin32.java`** So, how about it?
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
