Skip to content

Conversation

@nfaltermeier
Copy link

This PR allows passing extra arguments to the user script. For example, calling perftree ./program.exe a b will result in diff making this call: ./program.exe a b <depth> <fen> <moves>.

With this change I was able to run my program through a bash script on Windows with git bash perftree "C:\Program Files\Git\bin\bash.exe" ./fox-perftree.sh so I think this would close #7.

I have setup my program to run perft when called like so: ./program.exe perft <depth> <fen> <moves>. I tried to setup a script to call my program like this, but was not able to get it working on Windows:

  1. If I had perftree try to call the script directly perftree .\script.ps1 then I got this error: cannot compute diff: failed to execute user script: %1 is not a valid Win32 application. (os error 193)
  2. If I had perftree call the script interpreter (bash or powershell) with the script, it ignored it and did not pass the script name to the interpreter. Calling perftree powershell .\script.ps1 means it calls powershell <depth> <fen> <moves>.
  3. If I used quotes to include the argument in the script command perftree "powershell .\script.ps1" then I got this error cannot compute diff: failed to execute user script: The system cannot find the path specified. (os error 3)

I was not able to run my program though a powershell script because it interpreted each space in the fen as a separate argument. This should be fixable by adding parsing logic in my script or my program, but I don't care to put in the effort for that. This is consistent with the Command.arg() documentation https://doc.rust-lang.org/stable/std/process/index.html#windows-argument-splitting.

For completeness just before posting this I tested using Windows Command Line Batch script. That just worked, this change is not necessary to use that. Oh well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cannot compute diff: %1 is not a valid win32 application (os error 193)

1 participant