warden icon indicating copy to clipboard operation
warden copied to clipboard

Feature: Ability to Pipe into `warden shell`

Open navarr opened this issue 2 years ago • 3 comments

(/) Acceptance Criteria

  • warden shell detects if contents are being piped into it
  • warden shell treats contents piped into it as if a -C flag had been passed
  • warden shell by itself still launches a container

e.g. warden shell should act like bash

(?) Technical Information

if [[ -z "$value" && ! -t 0 ]]; then
    while read -r piped; do
      value+=$piped
    done;
fi

Source: https://stackoverflow.com/a/37243826

Discussed in https://github.com/orgs/wardenenv/discussions/654

Originally posted by cjnewbs June 1, 2023 Hi, I'm creating a makefile to setup local environments automatically. I've got most of it working but I am having trouble running bin/magento s:up. I can run it interactively from within warden shell but I would like to be able to do something like:

echo "bin/magento s:up" | warden shell

Which is similar to running a setup SQL which I do like so:echo "$$SQL" | warden db import, however trying it with warden shell results in the error the input device is not a TTY

Any ides?

navarr avatar Jun 19 '23 13:06 navarr

What's the benefit of this over just doing something like warden shell -c "bin/magento s:up"?

bap14 avatar Jul 30 '23 18:07 bap14

@bap14 Not much. The one benefit would be that it would work like people tend to expect

navarr avatar Jul 31 '23 15:07 navarr

This does work warden env exec -T php-fpm bin/magento

fooman avatar Aug 03 '23 02:08 fooman