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)
Sun, Sep 15, 2:27 AM
Unknown Object (File)
Sun, Sep 15, 2:26 AM
Unknown Object (File)
Sun, Sep 15, 2:26 AM
Unknown Object (File)
Sun, Sep 15, 2:26 AM
Unknown Object (File)
Sun, Sep 15, 2:25 AM
Unknown Object (File)
Sat, Sep 7, 1:46 PM
Unknown Object (File)
Wed, Aug 28, 2:45 AM
Unknown Object (File)
Sun, Aug 25, 10: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.