Resolve issues with P4EDITOR or P4DIFF

Your Windows users might experience difficulties using the Helix Core Server Command-Line Client (p4.exe) if they use the P4EDITOR or P4DIFF environment variables.

The reason for this is that Helix Core Server applications sometimes use the DOS shell (cmd.exe) to start programs such as user-specified editors or diff utilities. Unfortunately, when a Windows command is run (such as a GUI-based editor like notepad.exe) from the shell, the shell doesn’t always wait for the command to complete before terminating. When this happens, the Helix Core Server client then mistakenly behaves as if the command has finished and attempts to continue processing, often deleting the temporary files that the editor or diff utility had been using, leading to error messages about temporary files not being found, or other strange behavior.

You can get around this problem in two ways:

  • Unset the environment variable SHELL. Helix Core Server applications under Windows use cmd.exe only when SHELL is set; otherwise they call spawn() and wait for the Windows programs to complete.
  • Set the P4EDITOR or P4DIFF variable to the name of a batch file whose contents are the command:

    start /wait program %1 %2

    where program is the name of the editor or diff utility you want to invoke. The /wait flag instructs the system to wait for the editor or diff utility to terminate, enabling the Helix Core Server application to behave properly.

    Some Windows editors (most notably, Wordpad) do not exhibit proper behavior, even when instructed to wait. There is presently no workaround for such programs.