# Tests receiving empty output/whitespace after switching to linenoise

**URL:** <https://forum.codecrafters.io/t/tests-receiving-empty-output-whitespace-after-switching-to-linenoise/15783>\
**Category:** Challenges\
**Tags:** challenge:shell\
**Created:** [January 15, 2026, 5:54pm UTC](https://forum.codecrafters.io/t/tests-receiving-empty-output-whitespace-after-switching-to-linenoise/15783 "2026-01-15T17:54:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Millenarysnow](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/millenarysnow/32/22225_2.png) [@Millenarysnow](https://forum.codecrafters.io/u/Millenarysnow)\
**Post date:** [January 15, 2026, 5:54pm UTC](https://forum.codecrafters.io/t/tests-receiving-empty-output-whitespace-after-switching-to-linenoise/15783/1 "2026-01-15T17:54:36Z")

</div>

Hi everyone,

I’m currently working on the Autocompletion stage of the Build your own Shell challenge in C++. Instead of the recommended readline library, I decided to use the linenoise library (integrated directly into my vendor directory).

After implementing the completion logic and switching my input handling to use linenoise(), I encountered a strange issue where the CodeCrafters tester receives empty strings (or just whitespace) instead of my program’s output.

Crucially, this issue is a regression affecting previous stages. Tests that used to pass (like Stage #CZ2: Invalid Commands) are now failing on the server, even though they still work perfectly in my local environment.

Here is the failure log from the server (Stage #CZ2):

```shell
[tester::#CZ2] Running tests for Stage #CZ2 (Handle invalid commands)
[tester::#CZ2] Running ./your_program.sh
[your-program] $ invalid_mango_command
[your-program]                        
[tester::#CZ2] ^ Line does not match expected value.
[tester::#CZ2] Expected: "invalid_mango_command: command not found"
[tester::#CZ2] Received: " "
[tester::#CZ2] Assertion failed.
[tester::#CZ2] Test failed

```

My Code Context:

My full code is available on GitHub (since it’s a bit too much to paste here):  
[Millenarysnow/codecrafters-shell-cpp](https://github.com/Millenarysnow/codecrafters-shell-cpp)

Briefly, I am capturing input like this:

```cpp
void MyShell::Shell::input()
{
    // ... setup ...
    char* line = linenoise("$ ");
    if (line == nullptr) return;
    Input = string(line);
    free(line);
    // ... processing ...
}

```

It seems like linenoise might be interfering with the output buffering or the terminal state (Raw mode vs. Cooked mode) in the test environment, causing the output stdout/stderr to be lost or not captured by the tester.

Has anyone ran into similar issues with linenoise on this platform? Is there a specific way to ensure the terminal state is flushed or reset correctly before printing results?

Any help would be appreciated!

---

<div class="post-metadata">

**Author:** ![Millenarysnow](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/millenarysnow/32/22225_2.png) [@Millenarysnow](https://forum.codecrafters.io/u/Millenarysnow)\
**Post date:** [January 16, 2026, 11:42am UTC](https://forum.codecrafters.io/t/tests-receiving-empty-output-whitespace-after-switching-to-linenoise/15783/4 "2026-01-16T11:42:11Z")

</div>

Please!!! Could somebody can help me

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [January 26, 2026, 9:27am UTC](https://forum.codecrafters.io/t/tests-receiving-empty-output-whitespace-after-switching-to-linenoise/15783/5 "2026-01-26T09:27:51Z")

</div>

Hey @Millenarysnow, looks like you’ve got past this stage. Do you happen to remember what was wrong? Would love to see if we can improve the tester / instructions.

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [February 1, 2026, 1:04pm UTC](https://forum.codecrafters.io/t/tests-receiving-empty-output-whitespace-after-switching-to-linenoise/15783/7 "2026-02-01T13:04:54Z")

</div>

Closing this thread due to inactivity. If you still need assistance, feel free to reopen or start a new discussion!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [February 6, 2026, 1:05pm UTC](https://forum.codecrafters.io/t/tests-receiving-empty-output-whitespace-after-switching-to-linenoise/15783/8 "2026-02-06T13:05:00Z")

</div>

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
