While implementing custom SCons toolchain, I've encounter situation when I need to invoke shell as Phony target with initial input already provided, so I can continue to provide input to already invoked command.
Basically, what I want is to declare Phony target with desired behaviour:
# ...
def invoke_shell(target, source, env):
initial_input = '...'
# Some steps to interactive command with already provided initial_input
shell = env.Command(Alias('some-shell'), [],
invoke_shell)
env.AlwaysBuild(shell)
What I've tried is to write the following SConstruct file to cover case without initial input:
# ...
def invoke_yosys(target, source, env):
return 'yosys'
yosys_shell = env.Command(Alias('yosys-shell'), [],
invoke_yosys)
env.AlwaysBuild(yosys_shell)
So when I invoke scons -Q yosys-shell
I should get Yosys shell, but in general case it can be any interactive command. What I expect is that shell is invoked interactively, i.e. I can enter command and Yosys shell will interactively execute commands while providing input. But it doesn't work. It exits immediately as if stdin
is mapped to /dev/null
.
question from:
https://stackoverflow.com/questions/65863537/how-can-i-invoke-interactive-shell-with-initial-input-as-scons-phony-target 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…