You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For each of stdin, stdout, and stderr, the stream will be accessible on the child process object if and only if "pipe" was passed as the relevant stdio options. For example, if you did var child = spawn(cmd, args, { stdio: ["pipe", someStream, "pipe"]}, then you would be able to read child.stderr and write child.stdin, but child.stdout would be null.
Currently, there's no handling of this. The types say that all three are always available, and so you can get null out when you try to access child.stdout. I'm not sure how best to handle this, but I think a good start would just be throwing an error inside the accessors stdout, stderr, stdin so that at least the cause and fix is obvious. Currently, a null would leak into your program, which would probably throw an error eventually, but it might be a long way away from the actual problem. Not ideal.
I'm going to implement the above in my PR in a second, but I just wanted to raise this issue in case you have any better ideas.
The text was updated successfully, but these errors were encountered:
Maybe that's why I separated the effects out and never go around to making smart constructors? Sorry, I can't really remember. I think it'd probably be better to not have to deal with nulls creeping in if we can help it.
Currently it just throws an error if the stream turns out to be null. I'm struggling to come up with a safer API right now. I think I'll just open an issue on the purescript-node repository and maybe come back to it later. Thanks!
For each of stdin, stdout, and stderr, the stream will be accessible on the child process object if and only if "pipe" was passed as the relevant
stdio
options. For example, if you didvar child = spawn(cmd, args, { stdio: ["pipe", someStream, "pipe"]}
, then you would be able to readchild.stderr
and writechild.stdin
, butchild.stdout
would be null.Currently, there's no handling of this. The types say that all three are always available, and so you can get
null
out when you try to accesschild.stdout
. I'm not sure how best to handle this, but I think a good start would just be throwing an error inside the accessorsstdout
,stderr
,stdin
so that at least the cause and fix is obvious. Currently, anull
would leak into your program, which would probably throw an error eventually, but it might be a long way away from the actual problem. Not ideal.I'm going to implement the above in my PR in a second, but I just wanted to raise this issue in case you have any better ideas.
The text was updated successfully, but these errors were encountered: