diff --git a/doc/ChangesSummary.html b/doc/ChangesSummary.html
index 806db14..b5b5bbc 100755
--- a/doc/ChangesSummary.html
+++ b/doc/ChangesSummary.html
@@ -19,6 +19,7 @@
[V3.4.1 -> V3.5.0] 4th February 2026
+ - Fixed non-blocking stdin polling deadlock on MSWindows anonymous pipes when running interactive measurement tools in subprocess mode.
- Added -d switch to printtarg to allow custom chart label strings or omit labelling entirely.
- Added MSWindows ARM release.
- Added Mac ARM release.
diff --git a/spectro/conv.c b/spectro/conv.c
index dd2cb2d..eeeae18 100644
--- a/spectro/conv.c
+++ b/spectro/conv.c
@@ -203,36 +203,37 @@ static int con_char(int wait) {
/* We assume pipe has been set to NOWAIT mode. */
} else if (stdin_type == FILE_TYPE_PIPE) {
int i, bib;
-//fprintf(stderr,"~1 top of pipe\n");
+ DWORD bytes_avail = 0;
+
+ /* Check available bytes in pipe before blocking */
+ if (!PeekNamedPipe(stdinh, NULL, 0, NULL, &bytes_avail, NULL) || bytes_avail == 0) {
+ if (!wait) {
+ return 0;
+ }
+ }
for (bib = 0; bib < 10;) {
-//fprintf(stderr,"~1 got %d in buf\n",bib);
+ if (!wait) {
+ if (!PeekNamedPipe(stdinh, NULL, 0, NULL, &bytes_avail, NULL) || bytes_avail == 0) {
+ break;
+ }
+ }
if ((!ReadFile(stdinh, buf + bib, 10 - bib, &bread, NULL) || bread == 0)
&& !wait) {
-//fprintf(stderr,"~1 no chars waiting\n");
break;
}
bib += bread;
for (i = 0; i < bib; i++) {
if (buf[i] == '\n' || buf[i] == '\r' || buf[i] == 0x3) {
-//fprintf(stderr,"~1 found lf at ix %d\n",i);
break;
}
}
if (i < bib) {
-//fprintf(stderr,"~1 found lf\n");
break; /* Found '\n' */
}
Sleep(100); /* Wait for a line ending in '\n' */
}
-
-//if (bread > 0) {
-//fprintf(stderr,"~1 read %d: ",bread);
-//for (i = 0; i < bread; i++)
-//fprintf(stderr," 0x%x",buf[i]);
-//fprintf(stderr,"\n//");
-//}
rv = buf[0];
/* Assume a file. This will have very limited functionality. */