p4 editcommand fails.For example, one user didn't have the right P4CLIENT set so it failed with "Path is not under client root ".I would have expected p4 edit to exit with an error code, so I would be able to check if ERRORLEVEL == 0 for success or non-zero for failure. This is pretty standard for command line tools, but apparently p4 does not do this, because ERRORLEVEL stays set to 0 even after this error.I could check if the files are writable after having done p4 edit. Is that what other people do in this circumstance? Any other options?Thanks in advance,J-S
[Solved] How to detect p4 edit failed in a batch file?
Posted 19 February 2020 - 04:41 AM
Posted 19 February 2020 - 01:36 PM
p4 edit *.exe *.dll *.pdb && set WRITEOK=1 IF NOT DEFINED WRITEOK ( ECHO Unable to checkout files. Exiting now! goto CheckoutError )
This works for me. If anyone has another suggestion I'm still interested but I'll mark this question resolved.
Posted 19 February 2020 - 03:34 PM
Posted 19 February 2020 - 04:29 PM
Posted 19 February 2020 - 06:06 PM
Realistically I've generally used Perl for most Perforce scripting, using regexes to grab specific messages. Nowadays I'd probably use P4Python.
Posted 19 February 2020 - 06:56 PM
Posted 19 February 2020 - 07:54 PM
There's also this one, which I used on a very regular basis before "p4 grep" existed: https://swarm.worksh...ipts/p4find.bat
Luckily all of that cut/sed stuff was eventually obsoleted by the "-F" flag. https://web.archive..../fun-formatting
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users