mtkennerly / shawl

Windows service wrapper for arbitrary commands
MIT License
448 stars 15 forks source link

UNC Path are not supported #46

Closed imranzahid01 closed 4 months ago

imranzahid01 commented 4 months ago

I have a bat file which I need to convert into a service. shawl executable is in D:\myproject\shawl\shawl.exe I ran the following commands:

shawl add --name MyTest --cwd D:\myproject\test\ -- D:\myproject\test\run_app.bat

When I run the service I get the following error in the logs:

2024-03-02 04:57:29 [DEBUG] ********** LAUNCH **********
2024-03-02 04:57:29 [DEBUG] Cli { sub: Add { common: CommonOpts { pass: None, restart: false, no_restart: false, restart_if: [], restart_if_not: [], stop_timeout: None, no_log: false, no_log_cmd: false, log_dir: None, log_as: None, log_cmd_as: None, log_rotate: None, log_retain: None, pass_start_args: false, env: [], path: [], priority: None, command: ["D:\\myproject\\test\\run_app.bat"] }, cwd: Some("\\\\?\\D:\\myproject\\test"), dependencies: [], name: "MyTest" } }
2024-03-02 04:57:29 [DEBUG] Finished successfully
2024-03-02 04:57:42 [DEBUG] ********** LAUNCH **********
2024-03-02 04:57:42 [DEBUG] Cli { sub: Run { common: CommonOpts { pass: None, restart: false, no_restart: false, restart_if: [], restart_if_not: [], stop_timeout: None, no_log: false, no_log_cmd: false, log_dir: None, log_as: None, log_cmd_as: None, log_rotate: None, log_retain: None, pass_start_args: false, env: [], path: [], priority: None, command: ["D:\\myproject\\test\\run_app.bat"] }, cwd: Some("\\\\?\\D:\\myproject\\test"), name: "MyTest" } }
2024-03-02 04:57:42 [DEBUG] Entering main service loop
2024-03-02 04:57:42 [INFO] Launching command
2024-03-02 04:57:42 [DEBUG] stderr: "'\\\\?\\D:\\myproject\\test'"
2024-03-02 04:57:42 [DEBUG] stderr: "CMD.EXE was started with the above path as the current directory."
2024-03-02 04:57:42 [DEBUG] stderr: "UNC paths are not supported.  Defaulting to Windows directory."
2024-03-02 04:57:42 [DEBUG] stdout: "C:\\Windows>java -Dbtm.resource=resources -jar mytest.jar run schedule "
2024-03-02 04:57:42 [DEBUG] stderr: "Error: Unable to access jarfile mytest.jar"
2024-03-02 04:57:43 [INFO] Command exited with code 1

Is there a way to pass the value of cwd without converting it to UNC path?

mtkennerly commented 4 months ago

I just released v1.5.0 with a fix for this. Thanks for the report!