www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - D2 using std.proccess.shell

reply Jesse Phillips <jessekphillips gmail.com> writes:
I don't know if I'm misunderstanding the use of shell() or if this is a 
bug. Trying to run some programs with shell error with a could not close 
file. Sadly it I can come to any reasonable conclusion as to why.

Example output from running writeln(shell("gcc"))
gcc: no input files
std.contracts.ErrnoException: std/stdio.d(336): Could not close file 
`gcc' (Success)

Note that the program was executed correctly printing the error message, 
and the appended (Success) massage...? Also shell("gcc -v") works as with 
proper output and no error.

Similar errors trying to run shell("dmd") unsure if this is related to 
the programs not being in /bin.
Jul 06 2009
parent reply "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> writes:
Jesse Phillips wrote:
 I don't know if I'm misunderstanding the use of shell() or if this is a 
 bug. Trying to run some programs with shell error with a could not close 
 file. Sadly it I can come to any reasonable conclusion as to why.
 
 Example output from running writeln(shell("gcc"))
 gcc: no input files
 std.contracts.ErrnoException: std/stdio.d(336): Could not close file 
 `gcc' (Success)
 
 Note that the program was executed correctly printing the error message, 
 and the appended (Success) massage...? Also shell("gcc -v") works as with 
 proper output and no error.
 
 Similar errors trying to run shell("dmd") unsure if this is related to 
 the programs not being in /bin.
I think it's a bug in Phobos. Note that you get the exact same result even if you remove the enclosing writeln(), which means that the program's standard output stream hasn't been intercepted. Although I'm unsure about the details, it seems that the std.stdio.File object that should encapsulate the program's output stream isn't opened correctly, and thus an exception is thrown when an attempt is made to close it. Probably you don't get an error for "gcc -v" because the output of this command is printed to standard error instead of standard output. -Lars
Jul 07 2009
parent reply Jesse Phillips <jessekphillips gmail.com> writes:
On Tue, 07 Jul 2009 12:04:43 +0200, Lars T. Kyllingstad wrote:

 Jesse Phillips wrote:
 I don't know if I'm misunderstanding the use of shell() or if this is a
 bug. Trying to run some programs with shell error with a could not
 close file. Sadly it I can come to any reasonable conclusion as to why.
 
 Example output from running writeln(shell("gcc")) gcc: no input files
 std.contracts.ErrnoException: std/stdio.d(336): Could not close file
 `gcc' (Success)
 
 Note that the program was executed correctly printing the error
 message, and the appended (Success) massage...? Also shell("gcc -v")
 works as with proper output and no error.
 
 Similar errors trying to run shell("dmd") unsure if this is related to
 the programs not being in /bin.
I think it's a bug in Phobos. Note that you get the exact same result even if you remove the enclosing writeln(), which means that the program's standard output stream hasn't been intercepted. Although I'm unsure about the details, it seems that the std.stdio.File object that should encapsulate the program's output stream isn't opened correctly, and thus an exception is thrown when an attempt is made to close it. Probably you don't get an error for "gcc -v" because the output of this command is printed to standard error instead of standard output. -Lars
Thanks, I try and narrow down when this happens. I first assumed it was because running GCC without anything outputs to stderr and not stdout, but that wouldn't explain the DMD issue. ("ggc -v" goes to stdout)
Jul 07 2009
next sibling parent "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> writes:
Jesse Phillips wrote:
 On Tue, 07 Jul 2009 12:04:43 +0200, Lars T. Kyllingstad wrote:
 
 Jesse Phillips wrote:
 I don't know if I'm misunderstanding the use of shell() or if this is a
 bug. Trying to run some programs with shell error with a could not
 close file. Sadly it I can come to any reasonable conclusion as to why.

 Example output from running writeln(shell("gcc")) gcc: no input files
 std.contracts.ErrnoException: std/stdio.d(336): Could not close file
 `gcc' (Success)

 Note that the program was executed correctly printing the error
 message, and the appended (Success) massage...? Also shell("gcc -v")
 works as with proper output and no error.

 Similar errors trying to run shell("dmd") unsure if this is related to
 the programs not being in /bin.
I think it's a bug in Phobos. Note that you get the exact same result even if you remove the enclosing writeln(), which means that the program's standard output stream hasn't been intercepted. Although I'm unsure about the details, it seems that the std.stdio.File object that should encapsulate the program's output stream isn't opened correctly, and thus an exception is thrown when an attempt is made to close it. Probably you don't get an error for "gcc -v" because the output of this command is printed to standard error instead of standard output. -Lars
Thanks, I try and narrow down when this happens. I first assumed it was because running GCC without anything outputs to stderr and not stdout, but that wouldn't explain the DMD issue. ("ggc -v" goes to stdout)
Then you have a different version of GCC than I. From the man page of GCC 4.3.3: -v Print (on standard error output) the commands executed to run the stages of compilation. Also print the version number of the compiler driver program and of the preprocessor and the compiler proper. -Lars
Jul 08 2009
prev sibling parent reply "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> writes:
Jesse Phillips wrote:
 On Tue, 07 Jul 2009 12:04:43 +0200, Lars T. Kyllingstad wrote:
 
 Jesse Phillips wrote:
 I don't know if I'm misunderstanding the use of shell() or if this is a
 bug. Trying to run some programs with shell error with a could not
 close file. Sadly it I can come to any reasonable conclusion as to why.

 Example output from running writeln(shell("gcc")) gcc: no input files
 std.contracts.ErrnoException: std/stdio.d(336): Could not close file
 `gcc' (Success)

 Note that the program was executed correctly printing the error
 message, and the appended (Success) massage...? Also shell("gcc -v")
 works as with proper output and no error.

 Similar errors trying to run shell("dmd") unsure if this is related to
 the programs not being in /bin.
I think it's a bug in Phobos. Note that you get the exact same result even if you remove the enclosing writeln(), which means that the program's standard output stream hasn't been intercepted. Although I'm unsure about the details, it seems that the std.stdio.File object that should encapsulate the program's output stream isn't opened correctly, and thus an exception is thrown when an attempt is made to close it. Probably you don't get an error for "gcc -v" because the output of this command is printed to standard error instead of standard output. -Lars
Thanks, I try and narrow down when this happens. I first assumed it was because running GCC without anything outputs to stderr and not stdout, but that wouldn't explain the DMD issue. ("ggc -v" goes to stdout)
It happens whenever the program you try to run has a nonzero return value. I'll file a bug report, if you haven't done it already. -Lars
Jul 09 2009
parent Jesse Phillips <jessekphillips gmail.com> writes:
On Thu, 09 Jul 2009 11:20:54 +0200, Lars T. Kyllingstad wrote:

 Jesse Phillips wrote:
 On Tue, 07 Jul 2009 12:04:43 +0200, Lars T. Kyllingstad wrote:
 
 Jesse Phillips wrote:
 I don't know if I'm misunderstanding the use of shell() or if this is
 a bug. Trying to run some programs with shell error with a could not
 close file. Sadly it I can come to any reasonable conclusion as to
 why.

 Example output from running writeln(shell("gcc")) gcc: no input files
 std.contracts.ErrnoException: std/stdio.d(336): Could not close file
 `gcc' (Success)

 Note that the program was executed correctly printing the error
 message, and the appended (Success) massage...? Also shell("gcc -v")
 works as with proper output and no error.

 Similar errors trying to run shell("dmd") unsure if this is related
 to the programs not being in /bin.
I think it's a bug in Phobos. Note that you get the exact same result even if you remove the enclosing writeln(), which means that the program's standard output stream hasn't been intercepted. Although I'm unsure about the details, it seems that the std.stdio.File object that should encapsulate the program's output stream isn't opened correctly, and thus an exception is thrown when an attempt is made to close it. Probably you don't get an error for "gcc -v" because the output of this command is printed to standard error instead of standard output. -Lars
Thanks, I try and narrow down when this happens. I first assumed it was because running GCC without anything outputs to stderr and not stdout, but that wouldn't explain the DMD issue. ("ggc -v" goes to stdout)
It happens whenever the program you try to run has a nonzero return value. I'll file a bug report, if you haven't done it already. -Lars
Thanks.
Jul 09 2009