doomemacs / doomemacs/core

Invalid handling stdin in doomscript file from piped input

Open
#8,413 1 comment 0 reactions 0 assignees View on GitHub
is:bug needs-triage
Dominant language
Emacs Lisp
Stars
22.7k
Forks
3.1k
Avg merge
10h 46m
Merged PRs (30d)
4

Description

### I confirm that...

- [x] I have searched the [issue tracker](https://github.com/doomemacs/doomemacs/issues), [documentation](https://docs.doomemacs.org), [FAQ](https://docs.doomemacs.org/-/faq), [Discourse](https://discourse.doomemacs.org), and [Google](https://google.com), in case this issue has already been reported/resolved.

- [x] I have read "[How to Debug Issues](https://doomemacs.org/d/how2debug)", and will use it to provide as much information about this issue as possible.

- [x] The issue can be reproduced on the **latest** available commit of Doom.

- [x] The issue can be reproduced on a stable release of Emacs, such as 27, 28, 29, or 30. *(Unstable versions end in .50, .60, or .9x)*

### Expected behavior

Doomscript file should process all lines from stdin, whether the input is piped or not.

### Current behavior

When running doomscript file with piped input, first line of the input is consumed before evaluating the program code.

### Steps to reproduce

1. Create test doomscript file (for example `~/.config/doom/bin/example`) with the following contents:
```elisp
#!/usr/bin/env doomscript

(defcli! example ()
(while t
(print (reverse (read-from-minibuffer "")))))

(run! "example")
```

2. Run the script normally to observe the expected behavior:
```sh
$ ./example
123
"321"
456
"654"
```

3. Run the script with piped input:
```sh
$ cat | ./example
123
456
"654"
```
4. Observe that the first line is missing from the output and only the second line is processed.

### System Information

https://pastebin.com/XXnHcpbs

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.