[Issue 17250] ProcessPipes (std.process) should provide a test for a null pid

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 17 12:34:14 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17250

--- Comment #6 from Jon Degenhardt <jrdemail2000-dlang at yahoo.com> ---
(In reply to Jon Degenhardt from comment #5)
> (In reply to Vladimir Panteleev from comment #4)
> > (In reply to Jon Degenhardt from comment #1)
> > > The problem is that there is no method available to determine if pid is null
> > > prior to call the pid() method.
> > 
> > Why not: if (pipes !is ProcessPipes.init)
> 
> Isn't 'is' a compile-time expression? The test needs to be run-time. Though
> that would mean 'if (pipes != ProcessPipes.init)' would work. Either way,
> these seem like very obscure ways to do such a test.

Never mind the 'compile-time expression' part, 'is' is a run-time test. Still,
it seems very obscure, and it's not obvious that a ProcessPipes struct that has
a null PID due to process startup failure will be in the same state as the
struct at .init time.

--


More information about the Digitalmars-d-bugs mailing list