Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

When called from another shell script, fish can't read #3805

Copy link
Copy link

Description

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

fish version installed (fish --version): fish, version 2.3.1

OS/terminal used: Debian Linux (jessie), xterm

I wrote a script using #!/usr/bin/fish. The script calls read. Works fine from command line but not when called from another script.

Reproduction steps

nr@homedog ~/net> call-fish-read 
fish: Couldn't grab control of terminal
tcsetpgrp: Interrupted system call

nr@homedog ~/net> fish-read
say something⏎                                                                  asdf

asdf
nr@homedog ~/net> /usr/bin/fish --version
fish, version 2.3.1-dirty

Scripts are attached in a zip file, but it may be easier to view source here.

Here is fish-read:

#!/usr/bin/fish

read -p 'echo -n say something >&2 ' -l -s answer
echo $answer

and here is call-fish-read:

#!/bin/ksh

mumble=$(fish-read)
echo $mumble

N.B. I downloaded a nightly of fish 2.4.0 from SUSE, and behavior is even more frustrating---the shell just hangs trying to read file descriptor 3. Not sure what's up with that (I poked at it with strace -f.)

Would love to have a workaround that enables me to use a fish script as a tool in other scripts.
demo-scripts.zip

May be related to #3223 and #1258.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that's not working as intendedSomething that's not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.