-
Notifications
You must be signed in to change notification settings - Fork 5k
[Feature] Support worker server to run bat script #2015
Copy link
Copy link
Closed
Labels
featurenew featurenew feature
Description
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 byJNAprivate static native String environmentBlock();
ProcessImpl.java: rewrrite it byJNAprivate 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?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featurenew featurenew feature