Page MenuHomePhabricator

Suppress stdin message if input is piped
ClosedPublic

Authored by joshuaspence on Jan 1 2015, 12:22 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 19, 5:43 PM
Unknown Object (File)
Tue, Dec 17, 6:32 AM
Unknown Object (File)
Tue, Dec 17, 4:50 AM
Unknown Object (File)
Fri, Dec 13, 7:14 PM
Unknown Object (File)
Fri, Dec 6, 7:57 PM
Unknown Object (File)
Tue, Dec 3, 12:01 PM
Unknown Object (File)
Tue, Dec 3, 10:25 AM
Unknown Object (File)
Sun, Dec 1, 11:51 AM
Subscribers

Details

Summary

Currently we output "Waiting for JSON parameters on stdin...", even if stdin is piped (for example, from echo).

Test Plan
> echo '{}' | arc call-conduit conduit.ping
{"error":null,"errorMessage":null,"response":"ip-10-161-81-110"}

> arc call-conduit conduit.ping
Waiting for JSON parameters on stdin...
{}
^D
{"error":null,"errorMessage":null,"response":"ip-10-161-81-110"}

Diff Detail

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

joshuaspence retitled this revision from to Suppress stdin message if input is piped.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.
epriestley edited edge metadata.

I believe we don't require posix, and I don't want to require it. You can do this:

if (!function_exists('posix_isatty') || posix_isatty(STDIN)) {
  // print message
}
This revision now requires changes to proceed.Jan 1 2015, 2:35 PM
joshuaspence edited edge metadata.

Don't require the POSIX extension

epriestley edited edge metadata.
This revision is now accepted and ready to land.Jan 1 2015, 11:27 PM
This revision was automatically updated to reflect the committed changes.