-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
run.command()
: Support for command-line piping
#1392
Comments
Rethought this a little since it was re-raised: Could have keyword arguments to the Alternatively, this could potentially be managed within the Too many possible solutions without a clear winner :-/ |
Okay, aborted on my first tentative attempt. One of the issues is that a piped image provided as input to a Python script may need to be accessed both at the point of loading e.g. into the scratch directory, and also at completion of the script for the use of |
In retrospect, after looking at the documentation more closely, it might be possible to support this without going to the extent of #1608.
|
Deferred:
|
Closed by #2678. |
When the Python script library was first provided, piping in/out of image data actually worked just as it does for binary executables; this was due to the use of
shell=True
in therun.command()
function. This capability was revoked as this function became more advanced; this however now prevents the use of piped images as the input / output of Python scripts.To restore support for this will require some gymnastics:
Command-line arguments will need to have a flag indicating if they are an input or an output image, much like the
.type_*()
C++ functions.The
app
module will need to replace the value of any '-
' input image argument with the contents ofstdin
. Therun.command()
function could either just display this, or replace any appearances of temporary image paths with '-
'.This I think would be easier than trying to detect the '
-
' withinrun.command()
(where information about whether it's an input or output would have been lost) and connect the processes'sstdin
to that of the main process.The
run.command()
function will need to be informed if the command call includes an output to a pipe, and store the contents ofstdout
from that call somewhere for theapp
module to write tostdout
of the main process.This can't strictly be done based on the "last"
run.command()
call, since a script may contain multiple outputs and an output piped image may not necessarily appear as part of the very last one.The text was updated successfully, but these errors were encountered: