www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Is there a way to anonymously execute some sh script contents?

reply Ky-Anh Huynh <saigon example.net> writes:
Hi,

I have some big shell script that may require user input. Using 
`pipeProcess` doesn't work as `pipe` doesn't allow user to 
provide custom input (FIXME).

I am creating some temporary files, put the script contents to 
that file and then invoke

[code]
spawnProcess([/path/to/shell, /path/to/temporary/script/file]);
[/code]

This works well with user interaction. However I don't really 
like the idea of using temporary files. Is there any better way?

Thanks for your reading.
Aug 01 2018
parent Gary Willoughby <dev nomad.uk.net> writes:
On Wednesday, 1 August 2018 at 14:58:56 UTC, Ky-Anh Huynh wrote:
 This works well with user interaction. However I don't really 
 like the idea of using temporary files. Is there any better way?
Maybe take a look at: https://dlang.org/library/std/process/pipe_shell.html
Aug 01 2018