The OPs command string reproducing the problem is, as displayed, incorrect (likely, a formatting issue). But the issue is present.
The simplest problematic command line is:
set /p = <NUL
This command string (a valid, working construct for CMD), causes CMD with clink to hang (with no response to CTRL-C. Constructs such as this are used to initialize files...
set /p = <NUL >FILE creates a 0 byte file, "FILE"
set /p =foo <NUL >FILE creates a 3-byte file, "FILE", containing only 'foo', without a newline
Of note, the alternative construct echo | set /p = >FILEdoes work correctly, without hanging, under CMD with clink.
Additionally, set /p VAR="" shows an incorrect prompt. It prints a shell prompt (from %PROMPT%), which is usually the current path followed by '>', e.g. "C:\Users>". It should print nothing. But, notably, set /p VAR="" does not hang; it correctly waits for a user input line and then sets VAR correctly.
@mridgers ,
The OPs command string reproducing the problem is, as displayed, incorrect (likely, a formatting issue). But the issue is present.
The simplest problematic command line is:
set /p = <NUL
This command string (a valid, working construct for CMD), causes CMD with clink to hang (with no response to CTRL-C. Constructs such as this are used to initialize files...
set /p = <NUL >FILE
creates a 0 byte file, "FILE"set /p =foo <NUL >FILE
creates a 3-byte file, "FILE", containing only 'foo', without a newlineOf note, the alternative construct
echo | set /p = >FILE
does work correctly, without hanging, under CMD with clink.Additionally,
set /p VAR=""
shows an incorrect prompt. It prints a shell prompt (from%PROMPT%
), which is usually the current path followed by '>', e.g. "C:\Users>". It should print nothing. But, notably,set /p VAR=""
does not hang; it correctly waits for a user input line and then sets VAR correctly.Thanks for looking into it.
Originally posted by @rivy in https://github.com/mridgers/clink/issues/398#issuecomment-313881322