Closed gimmi closed 2 years ago
BTW avoinding shawl add
command and creating service with the following command works as expected.
sc create MyApp binPath= "C:\Users\dev\Temp\MyApp.win-x64.0.8.1\shawl.exe run --stop-timeout 30000 --restart --cwd C:\Users\dev\Temp\MyApp.win-x64.0.8.1\ -- MyApp.exe"
Hmm, I'm not able to reproduce a failure with this. The \\?\
is just a UNC path prefix, so I'm not sure why it's interfering. Could you share the Shawl logs and/or any logs from your own app to indicate a specific error code?
Here's what I tested:
$ shawl add --name shawl --cwd . -- shawl-child.exe
$ sc start shawl
Path to executable: C:\git\shawl\target\debug\shawl.exe run --name shawl --cwd \\?\C:\git\shawl\target\debug -- shawl-child.exe
shawl_for_shawl_rCURRENT.log shows that shawl-child started successfully:
2022-01-16 23:33:29 [DEBUG] ********** LAUNCH **********
2022-01-16 23:33:29 [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, command: ["shawl-child.exe"], pass_start_args: false }, cwd: Some("\\\\?\\C:\\git\\shawl\\target\\debug"), name: "shawl" } }
2022-01-16 23:33:29 [DEBUG] Entering main service loop
2022-01-16 23:33:29 [INFO] Launching command
2022-01-16 23:33:29 [DEBUG] stderr: "[INFO] ********** LAUNCH **********"
2022-01-16 23:33:29 [DEBUG] stderr: "[INFO] Cli { infinite: false, exit: None, test: false }"
2022-01-16 23:33:29 [DEBUG] stderr: "shawl-child message on stderr"
2022-01-16 23:33:29 [DEBUG] stdout: "shawl-child message on stdout"
2022-01-16 23:33:30 [DEBUG] stderr: "[INFO] Looping!"
2022-01-16 23:33:30 [DEBUG] stderr: "[INFO] Looping!"
2022-01-16 23:33:31 [DEBUG] stderr: "[INFO] Looping!"
I did just find an issue while trying to test this, after I put shawl.exe and shawl-child.exe in different directories, but I'm not sure if it's related to your issue. The CWD technically only applies once the command is running, but Shawl doesn't use the CWD to find the command in order to run it in the first place, so it can't find a relative-style command when the exe is in a different place than Shawl itself. But it looks like you already have shawl.exe in the same place as MyApp.exe, so it might not be related.
I just published v1.1.0, which addresses what I mentioned in my last comment. When you have time, could you please give it a try, in addition to grabbing the log files?
I'm going to close this for now, but if you have a chance to test the new version and there's still an issue, I'd be happy to reopen it.
With this command
I get this in Windows service "Path to executable":
The problem is the weird
\\?\
in thecwd
parameter, that prevent the app from running appropriately.