Skip to content

Sudo breaks scripts that use "read" command to prompt users for input. #3223

Closed

Description

@audreytoskin
  • Have you checked if problem occurs with fish 2.3.1?
  • Tried fish without third-party customizations (check sh -c 'env HOME=$(mktemp -d) fish')?

fish version installed (fish --version):
2.3.1

OS/terminal used:
Fedora 24 (64-bit) / gnome-terminal 3.20.2

I've written a script that uses the read command to prompt the user for information. If I run the script as a normal user, or as root, it works as expected. But if I run the script with sudo, it throws an error message:

fish: Couldn't grab control of terminal
tcsetpgrp: Interrupted system call

...Which is similar to the original post in issue #1258, but possibly for different reasons? Running the script as root instead of via sudo is a workable, if maybe inconvenient workaround.

Here is a simple example script if you need to test:

#!/usr/bin/fish
echo "Who are you?"
read -x  username
echo "Hello, $username!"

Activity

  1. faho commented on Jul 13, 2016

    @faho
    Member

    ...Which is similar to the original post in issue #1258, but possibly for different reasons?

    It seems similar enough to me that I'll close this one as a duplicate. Thanks!

  2. locked as resolved and limited conversation to collaborators on Apr 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions