Skip to content

Shell.Job.add freezes and appends marker #192

@KonerDev

Description

@KonerDev

Description

When using the following method to write file content:

public static void setFileContent(String path, String content) {
    Shell.getShell();

    ByteArrayInputStream inputStream = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8));
    Shell.cmd("cat > " + path).add(inputStream).exec();
}

The resulting file contains the expected content, but an extra marker (e.g. __RET=$?;echo ade68241-...) is appended at the end.
In addition, the app freezes, so the command never seems to finish.

Expected Behavior

  1. The file should contain only the provided content, not any additional markers.
  2. The command should terminate after writing to the file without freezing.

Actual Behavior

  1. An unwanted marker (e.g. __RET=$?;echo ade68241-...) is appended to the file as the last line.
  2. The command appears to hang (or does not complete correctly), freezing the application.

There is no crash, but the whole application just freezes.

Environment

libsu version: 6.0.0
OS/Device: Android 14
Magisk Version: 27000

Maybe I misunderstood, but I thought the add method was for adding an input stream for the cat command. I would appreciate any help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions